restarting the game

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mixmaster
    New Member
    • Nov 2006
    • 5

    #1

    restarting the game

    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

    Thanks
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    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.

    Comment

    Working...