A question about a Questioning program..
Author |
Message |
Jesus
|
Posted: Mon Mar 06, 2006 10:28 am Post subject: A question about a Questioning program.. |
|
|
var number : int
randomize
randint(number, 1, 10)
loop
put "This program is a guessing game with numbers 1-10."
put " "
put "Try and guess what number I have chosen?"
get number
exit when number = number
end loop
well i know im missing a bunch, but the gest of it is, this...
*Write a program that starts with those three lines, then lets the user try to guess the value of 'number'. Do not let them exit the program until the guess the number. *
Im ahead of my class so im not asking for you guys to write the program, just a general direction if you could? |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Jesus
|
|
|
|
 |
Jesus
|
Posted: Mon Mar 06, 2006 10:31 am Post subject: (No subject) |
|
|
Sorry wrong forum.. Lol, i ment turing  |
|
|
|
|
 |
[Gandalf]

|
Posted: Mon Mar 06, 2006 5:01 pm Post subject: (No subject) |
|
|
Well, it's easier to help you if you ask a question...
Still, some pieces of advice I can give in this situation:
-You are using many 'deprecated' functions in your program, which are not neccessary unless you are using the old DOS Turing (doubtful). randomize is not needed at the start of your program anymore.
-You should probably be using the Rand.Int() function instead of the randint() procedure, but it's acceptable in this case.
-Use [code][/code] tags when posting code.
-Indent your code.
Now, about why your program doesn't work... Try to follow the logic of it all, you are assigning a random number to a variable, then assigning the users input to that same variable. You exit condition is obviously met at this point, because number = number, just like 1 = 1. What you need is to assign the random number to one variable, and have another for the users input. Then change your exit condition to check if the two variables are equal. |
|
|
|
|
 |
|
|