#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;
}
switch(expr) {
case 1:
// do something
break;
case 2:
// do something
break;
default:
// do something
}
Code Example |
---|
Cpp :: c++ code for quicksort |
Cpp :: sort vector in descending order |
Cpp :: use ::begin(WiFiClient, url) |
Cpp :: time function c++ |
Cpp :: pbds in c++ |
Cpp :: c++ type casting |
Cpp :: c++ count number of element in vector |
Cpp :: print vector of vector c++ |
Cpp :: for in c++ |
Cpp :: rand c++ |
Cpp :: getline cpp |
Cpp :: binary file in c++ |
Cpp :: Resize method in c++ for arrays |
Cpp :: c++ multidimensional vector |
Cpp :: less than operator overloading in c++ |
Cpp :: initialize 2d vector |
Cpp :: remove element from array c++ |
Cpp :: log base 10 c++ |
Cpp :: how to create a vector in c++ |
Cpp :: create a 2d vector in c++ |
Cpp :: how to debug c++ code in vs studio code |
Cpp :: sort vector in reverse order c++ |
Cpp :: C++ Volume of a Cylinder |
Cpp :: c++ function default argument |
Cpp :: sina + sinb formula |
Cpp :: factorial loop c++ |
Cpp :: Bresenham line drawing opengl cpp |
Cpp :: 2d vector in cpp |
Cpp :: tree to array c++ |
Cpp :: c plus plus |