switch-case statements in C and C++

switch(variable)
{
  case value: 
    //code
  case value:
    //code
  default: 
    //code
}
The braces are always needed following the switch statement. No braces are needed following any case. If the variable is equal to one of the values following a case, then the code following the case is executed. Execution will "fall through" from one case statement to the next, executing all code following the case statement, including code following other case statements and the default statement. The prevent falling through, include break;at the end of any code block. The default case will execute in the case that no other case is true.

Related

Switch case tutorial