Author |
Message |
Tubby_Kat
|
Posted: Wed Feb 25, 2009 7:08 pm Post subject: This Turing question is getting me confused!~ @_@ |
|
|
I've just started Turing so please don't bug me about how dumb I am on Turing, but I really need help on this problem. My older brother (who thinks he is the best at everything on Turing and any other computer program) told me to do this "simple" layout on turing.
I even know how to start this...if you can please help me with the minor steps in the problem, it would be very appreciated...
Make a program that makes the computer choose a random number between 1 and 100. The user has to guess the number. If it is wrong, then tell them if the answer was too high or too low. then the user can guess again. This will go on until the number the user gives the program is correct.
I know how to do the beginning and random numbers (with Turing Tutorials), but everything is so confusing to me. (I just started using Turning for a few days)
Mod Edit: Comic Sans? Seriously? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
saltpro15
|
Posted: Wed Feb 25, 2009 7:41 pm Post subject: Re: This Turing question is getting me confused!~ @_@ |
|
|
you're going to use a command called Rand.Int to generate the numbers, and a loop and if statement, and it'll look like this
code: |
var num : Rand.Int (1,100)
var guess : int
loop
get guess
if guess < num then
%do something
elsif guess = num then
% do something else
exit
elsif guess > num
% do something else
end if
end loop
|
hope that helps |
|
|
|
|
|
Insectoid
|
Posted: Wed Feb 25, 2009 9:42 pm Post subject: RE:This Turing question is getting me confused!~ @_@ |
|
|
you forgetted exit when saltpro15. |
|
|
|
|
|
Tony
|
|
|
|
|
Tubby_Kat
|
Posted: Thu Feb 26, 2009 6:19 pm Post subject: Re: This Turing question is getting me confused!~ @_@ |
|
|
Oh...so randint is used for random numbers and stuff...cool...Thanks guys! I totally get it now! |
|
|
|
|
|
saltpro15
|
Posted: Thu Feb 26, 2009 6:50 pm Post subject: RE:This Turing question is getting me confused!~ @_@ |
|
|
hey Tony I didn't give him the answer, he still has to do some work. and no problem tubby_kat |
|
|
|
|
|
|