Newbie question. please help me :D
If the code is like this:
1 2 3 4 5 6 7 8 9 10 11 12
|
cout << "Please type 1 for ----" << endl;
cout << "Please type 2 for ----" << endl;
cin >> type;
switch(type)
{
case 1:
etc....
case 2:
etc....
}
|
is it possible to jump from case 2 to case 1? help me answer this please? i need it badly.
any form of "jumping" is bad practice, but you can use fall through by omitting a break.
1 2 3 4 5 6 7 8 9 10 11 12
|
switch(type)
{
case 3:
// blah
break;
case 2:
// blah
// missing break statement, will fall through to "case 1"
case 1:
// blah
break;
}
|
ohh yeah i forgot the break :) thank you so much.
Topic archived. No new replies allowed.