You have to use either of the following two code to break outer loop from switch case. It is very simple to do this. In first code you have to use goto out statement. In the second code you have to use break statement. In the first code I also have use for loop to get proper result.
Code:
for (int k=0; k < 15; k++)
{
switch(k)
{
cases 6: break;
cases 7: goto out;
}
}
out:
Now you have to use following code.
Code:
for (int k=0, out=0; k < 15 && out != 0; k++)
{
switch(k)
{
cases 6: break;
cases 7: out = 1; break;
}
}
Bookmarks