By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,034 Members | 822 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,034 IT Pros & Developers. It's quick & easy.

restarting the game

P: 5
Hi All

I have created a math game and i was wanting to have an option at the end of it

Saying "would you like to try again y / n"

how can i make the program do this
If the person press's y it re-starts if no it exits

Dec 4 '06 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,652
You can enclose the entire test in a do...while loop. Set the end condition of the loop to characterVar == 'y', and as the last step in your loop, ask the user for input into this characterVar. As long as the user enters y, the test will run again.
Dec 4 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.