Computer Science Canada put statements |
Author: | w0lv3rin3 [ Wed Apr 23, 2003 8:09 pm ] | ||
Post subject: | put statements | ||
2 questions i have a code here
i want it so that when user input it will come up like the following 1. hello 2. hi 3. bye etc. . . . . . to 7 2end question is how can i have it so that user can also input side by suide like this 1. hello, 2. hi, 3. bye etc . . . . . . to 7 |
Author: | Dan [ Wed Apr 23, 2003 8:17 pm ] | ||
Post subject: | |||
if you put .. at the end of the stamend the next input or output will be at the end of the line insted of the next line. Ex.
this whode look like this: put in a num: 6 |
Author: | w0lv3rin3 [ Wed Apr 23, 2003 8:26 pm ] |
Post subject: | |
how about side by side? |
Author: | Ancalagon The Black [ Wed Apr 23, 2003 8:27 pm ] | ||
Post subject: | |||
This should do you for now. The only thing I haven't done is to get them all lined up. But with seven words, unless you have a big run window, they'll get cut off. We just started doing arrays so this was good practise for me. In fact, I figured out something while doing this that I need to incorporate into my own program! ![]() |
Author: | w0lv3rin3 [ Wed Apr 23, 2003 8:43 pm ] | ||||
Post subject: | |||||
i am using that code u told me i added it into my code, those words will be used in this code
i then get error Assigned value is the wrong type |
Author: | Ancalagon The Black [ Wed Apr 23, 2003 9:14 pm ] | ||
Post subject: | |||
I don't know what you're trying to do at the end here. But first of all, if you don't have word declared as a variable (needs to be an array too) then the program isn't going to like you. It looks like you're doing a hangman program so I think what you need to do is create a list of words, and make the program pick one of them randomly at the beginning of the program. Then when the user inputs seven guesses, you're going to have to make an "if" statement that says for each wrong word, put "wrong", and if the right word is guessed, then put "right!" at the end of the correct word. Something like:
Then you'd probly want to loop the whole thing so that if the player guesses right then the program will start again with a new word. And if the player guesses wrong, then to put game over and exit. I'll have to see if I can get more on this for you later. |
Author: | jamez [ Wed Apr 23, 2003 9:16 pm ] |
Post subject: | |
youre using arrays incorrectly. this tutorial should help http://compsci.ca/bbs/viewtopic.php?t=366 |
Author: | w0lv3rin3 [ Wed Apr 23, 2003 9:48 pm ] |
Post subject: | |
i am trying to have it so when i type in 7 words, then those words will be then retrieved from word (1) := inwrd word (2) := inwrd word (3) := inwrd word (4) := inwrd word (5) := inwrd word (6) := inwrd word (7) := inwrd randomly |
Author: | w0lv3rin3 [ Wed Apr 23, 2003 10:02 pm ] | ||
Post subject: | |||
this is my code
|
Author: | Tony [ Wed Apr 23, 2003 10:37 pm ] |
Post subject: | |
inwrd is an array (a 1..7) array. And you're trying to assign a WHOLE array into a single element of it. Instead you should have word(1) := inwrd(1) word(2) := inwrd(2) If you haven't done so already, read a tutorial on arrays http://compsci.ca/bbs/viewtopic.php?t=366 Hopefully it will explain them better. It also gives some proper examples of using arrays. If you still have problems, dont mind posting (also sujestions if there's something missing in tutorial) |
Author: | w0lv3rin3 [ Wed Apr 23, 2003 10:43 pm ] |
Post subject: | |
thx, alot |