My question is about using something other than goto to go back to the beginning of operations from the default of a switch statement. I think it could be done by
it should go back to the beginning of the while loop >?
I'm not sure perhaps you should run a small test to see and post your results back here. you can do something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
while(true)
{
int i=1;
cout << "inside while " << i << "\n";
switch( i )
{
case 1:
case 2:
case 3:
cout << "inside switch " << i << "\n";
i++;
continue;
default:
cout << "inside default\n";
break;
}
cout << "Bottom of while " << i << endl;
break;
}
while(quit = false)
should be: while(quit == false)
The code I posted works perfectly fine, however for some reason i is never incremented because it's a switch and you can't change the value of the switch or some such....
so you get a never ending loop:
inside while 1
inside switch 1
inside while 1
inside switch 1
inside while 1
inside switch 1
inside while 1
inside switch 1
inside while 1
inside switch 1
inside while 1
inside switch 1
... etc