c++ switch

C++
switch (n)
{
    case 1: // code to be executed if n = 1;
        break;
    case 2: // code to be executed if n = 2;
        break;
    default: // code to be executed if n doesn't match any cases
}switch(expression) {
  case x:
    // code block
    break;
  case y:
    // code block
    break;
  default:
    // code block
}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);
}
switch(expression) {
   case 1:
      //equivalent to if(expression == 1){//do someting...}
      //do something...
      break; 
    //if case 1 is true the rest of the statments arn't 
    //evaluated because of the break
   case 45:
      //equivalent to else if(expression == 45){//do someting...}
      //do something...
      break;
    
   // you can have any number of case statements and default has to be last
   default :
      // equivalent to else{//do someting...}
      //do something...
}

switch(expression) {
   case 1:
      //equivalent to if(expression == 1){//do someting...}
      //do something...
   case 45:
      //equivalent to if(expression == 45){//do someting...}
      //do something...
   default :
      //always runs if there are no breaks in any of the cases
      //do something...
}

//modification of answer by Homeless Hoopoeswitch (<espressione>)
{
case <valore costante 1>:
// istruzioni
break;


case <valore costante 2>:
// istruzioni
break;
...
case <valore costante N>:
// istruzioni
break;
default:
// istruzioni
break;
}
Source

Also in C++: