English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2 answers

My advice would be to use 'Do...While' like

int no = 0;
do
{
blah blah blah
.......................
cout<<"Wanna continue ? (-1 to exit)";
cin>>no;
} while(no != -1) (or) while(no >= 0)
This will work. If you want to use while loop or switch follow similar strategy.

2007-11-15 22:37:50 · answer #1 · answered by Sound brain 2 · 1 0

You can use break to jump out of the loop. Then you can return the -1 value from the function. Then you can throw an exception and end the program.

Your question was not very clear.

2007-11-15 22:11:30 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers