c++ switch multiple case code example
Example: c++ switch multiple cases
#include <iostream>
using namespace std;
int main() {
// variable declaration
int input;
switch(input){
case 1: case 2: case 3: case 4:
//executes if input is 1, 2, 3, or 4
break;
case 5: case 6: case 7:
//executes if input is 5, 6, or 7
break;
default:
//executes if input isn't any of the cases
}
return 0;
}