Looking to prevent a program from ending.

Hey guys what's up new guy here....

Anyways, I like to tinker around and do crazy stuff with C++ (who doesn't!?). However, I would like very much to keep programs going.

For example,

I want to make a program where the user will enter a city temperature and compare the temperature with another city.

I want to program my code to where that when you run it without debugging and get it to work, the window doesn't disappear once you press enter. I want the person to be able to enter as many temperatures as they want. I'd also like to do this for whatever program I write that doesn't involve comparing weather.

If anyone can help me out, I'd appreciate it.
Well, if you don't want it to end until you type quit or something, you could add this loop:

1
2
3
4
5
6
7
8
string answer;
while(answer != "no") {
     //your code
     while(answer != "yes" && answer != "no") {
          cout<<endl<<"Do you want to repeat? <yes/no> ";
          cin>>answer;
     }
}
thanks man... I appreciate it.
Topic archived. No new replies allowed.