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

Username:   Password: 
 RegisterRegister   
 How do I program an exit?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Edman




PostPosted: Thu Jan 06, 2005 1:14 am   Post subject: How do I program an exit?

So I have decided to rough it out. I am figuring this Turing stuff out for the most part, but I have run into a problem. Here's what I want to do:

I want to have the program ask "Would you like to play a game"

If the answer is "y" then the game begins

Now I know how to do the above, but how do I do this part:

If the answer is "n" then I want the program screen so say "goodbye" and the program ends.

Thank you.
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Thu Jan 06, 2005 9:19 am   Post subject: (No subject)

There are a bunch of ways of doing this...really, a lot.

A few suggestions:

- look up if statements.
With these, you would either procedurize your proggie (recommended), or encompass the entire thing in one big if.
- you could use a loop that covers the whole proggie, and have an exit condition when the response is 'n' or something to that effect. This would also give you the flexibility of restarting the game.
- you could use 'quit', but try stay away from this as Turing really doesn't forgive when it comes to that particular command.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: