Switch Method

Switch Method

#include <iostream>
using namespace std;
int main (int argc, char**argv){
int a;
cout<<" __________________________________________________________________________"<<endl;
cout<<"| Hammad Ahmad | BSCE-F17-012 | The University of Lahore, Islamabad Campus |"<<endl;
cout<<"|__________________________________________________________________________|"<<endl;
cout<<"please enter the value"<<endl;
cin>>a;
switch(a)
{
case 'a': {
cout<<"You Entered One"<<endl;
break;
}
case 'b': {
cout<<"You Entered Two"<<endl;
break;
}
case 'c': {
cout<<"You Entered Three"<<endl;
break;
}
case 'd': {
cout<<"You Entered Four"<<endl;
break;
}
case 'e': {
cout<<"You Entered Five"<<endl;
break;
}
case 'f': {
cout<<"You Entered Six"<<endl;
break;
}
case 'g': {
cout<<"You Entered Seven"<<endl;
break;
}
case 'h': {
cout<<"You Entered Eight"<<endl;
break;
}
case 'i': {
cout<<"You Entered Nine"<<endl;
break;
}
case 'j': {
cout<<"You Entered Ten"<<endl;
break;
}
default: {
cout<<"You Entered Invalid Value"<<endl;
}
}
return 0;
}

Post a Comment

0 Comments