Answers for "switch case int c++"

C++
175

c++ switch

switch(expression) {
  case x:
    // code block
    break;
  case y:
    // code block
    break;
  default:
    // code block
}
Posted by: Guest on February-21-2020
2

how to make a switch case statement in c++

#include <iostream>
using namespace std;
int main(){
   int num = 5;
   switch(num + 2) {
      case 1: 
        cout << "Case1: Value is: " << num << endl;
      case 2: 
        cout << "Case2: Value is: " << num << endl;
      case 3: 
        cout << "Case3: Value is: " << num << endl;
      default: 
        cout << "Default: Value is: " << num << endl;
   }
   return 0;
}
Posted by: Guest on March-04-2020
0

switch case sinax c++

switch (<espressione>)
{
case <valore costante 1>:
// istruzioni
break;


case <valore costante 2>:
// istruzioni
break;
...
case <valore costante N>:
// istruzioni
break;
default:
// istruzioni
break;
}
Posted by: Guest on March-24-2020

Browse Popular Code Answers by Language