can you use switch statement c++ code example
Example 1: initialize variable in switch case c++
switch (val)
{
case VAL:
{
// This will work
int newVal = 42;
break;
}
case ANOTHER_VAL:
...
break;
}
Example 2: switch in c++
switch (variable) {
case 1:
// code here
break
default:
// code here
break
}