#include <iostream>
using namespace std;
int main(){
int number;
cout<<"Enter an integer: ";
cin>>number;
switch (number){ //switch statement
case 1:
cout<<"NUMBER IS 1"<<endl;
break;
case 2:
cout<<"NUMBER IS 2"<<endl;
break;
case 3:
cout<<"NUMBER IS 3"<<endl;
break;
case 4:
cout<<"NUMBER IS 4"<<endl;
case 5:
cout<<"NUMBER IS 4 OR 5"<<endl;
break;
default:
cout<<"NUMBER IS NOT FROM 1 TO 5"<<endl;
break;
}
cout<<endl;
return 0;
}
Code Example |
---|
Cpp :: chrono library c++ |
Cpp :: appending int to string in cpp |
Cpp :: cpp list |
Cpp :: how to use decrement operator in c++ |
Cpp :: sort using lambda c++ |
Cpp :: set precision with fixed c++ |
Cpp :: switch case c++ |
Cpp :: how to make calculaor in c++ |
Cpp :: c++ nested switch statements |
Cpp :: memcpy c++ usage |
Cpp :: how to check if a number is prime c++ |
Cpp :: convert binary string to int c++ |
Cpp :: doubly linked list c++ code |
Cpp :: c++ create multidimensional vector |
Cpp :: c++ get environment variable |
Cpp :: convert string to lpstr |
Cpp :: aray of functions in c++ |
Cpp :: string to int c++ |
Cpp :: comparator for priority queue c++ |
Cpp :: continue c++ |
Cpp :: length of array in cpp |
Cpp :: convert unsigned long to string c++ |
Cpp :: how to sort in descending order in c++ |
Cpp :: cannot jump from switch statement to this case label c++ |
Cpp :: vector find |
Cpp :: bee 1002 solution |
Cpp :: cpp mutex |
Cpp :: stack overflow c++ |
Cpp :: c++ open file explorer |
Cpp :: sum of a matrix c++ |