cannot jump from switch statement to this case label c++ code example
Example 1: jump to case label c++
put everything in the case x: under {} brackets
metti tutto quello nel case x: sotto le parentesi {}
Example 2: error jump to case label
switch (choice)
{
case 1: get_two_numbers(x, y);
int sum = add(x, y);
cout << x << " + " << y << " = " << sum << endl;
break;
case 2: get_two_numbers(x, y);
int diff = subtract(x, y);
cout << x << " - " << y << " = " << diff << endl;
break;
default:;
}
Example 3: cannot jump from switch statement to this case label c++
switch(foo) {
case 1:
int i = 42;
dostuff(i);
break;
case 2:
dostuff(i*2);
}