Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 This Turing question is getting me confused!~ @_@
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tubby_Kat




PostPosted: 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
Sponsor
sponsor
saltpro15




PostPosted: 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




PostPosted: Wed Feb 25, 2009 9:42 pm   Post subject: RE:This Turing question is getting me confused!~ @_@

you forgetted exit when saltpro15.
Tony




PostPosted: Wed Feb 25, 2009 11:29 pm   Post subject: RE:This Turing question is getting me confused!~ @_@

uhh... guys -- http://compsci.ca/v3/viewtopic.php?t=20333
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Tubby_Kat




PostPosted: 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




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: