#include using namespace std; int main(){ for (int i=0; i<6 ; i++){ switch(i){ case 1: std::cout << "switch = 1" << std::endl; break; case 2: std::cout << "switch = 2" << std::endl; break; case 3: std::cout << "switch = 3" << std::endl; break; case 4: std::cout << "switch = 4" << std::endl; break; default: std::cout << "out of switch range" << std::endl; } } return 0; } $ !. ./a.exe out of switch range switch = 1 switch = 2 switch = 3 switch = 4 out of switch range