Cas dans CPP
#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;
}
ALeonidou