case staement c++ code example
Example 1: switch statement c++
switch(expression) {
case constant-expression :
statement(s);
break; //optional
case constant-expression :
statement(s);
break; //optional
// you can have any number of case statements.
default : //Optional
statement(s);
}
Example 2: switch c++
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
// code block
}