use switch statement in c++ code example
Example 1: switch c++
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
// code block
}
Example 2: switch in c++
switch (variable) {
case 1:
// code here
break
default:
// code here
break
}