| purlek (4) | |||
Hi, I've created a simple "Distance Calculator" for a game that I play frequently that uses grid/graph points occasionally, basically you tell it two (x, y) coords and it runs the distance formula on them.
Anyway, as you may have noticed, at the end there, there is an empty space, cout << "Would you like to find another distance? (1=Yes, 2=No) ", cin >> ad; if (ad == 1) { } and as mentioned in the title of this thread, I am asking if there is a way that, if the user enters 1 to restart and find another distance it will start the program from the top of the script. All help is appreciated, thanks in advance! ~Michael | |||
|
|
|||
| Novacrazy (1) | |
|
What you are looking for would be a loop. You can learn about them here: http://www.cplusplus.com/doc/tutorial/control/ Just put whatever code you need to repeat within a loop. | |
|
|
|
| purlek (4) | |
| thanks that did the trick! | |
|
|
|