Practice # 9.2
#include<iostream>
using namespace std;
// Here we discuss about in Selection Structure switch case
//Selection Structure switch case
int main() {
int age;
// Here we check the age for entry restriction
/* Actually the main purpose of switch case statments, a check
on a veriable not be reach on volatile state and in the switch
barackets must should have an integer verialble and in the case
syntex also have an integer value*/
cout<<"Enter your age"<<endl;
cin>>age;
switch (age)
{
case 15:
cout<<"Your are fifteen, You can Enter"<<endl;
break;
case 16:
cout<<"Your are sixteen, You can Enter"<<endl;
break;
case 17:
cout<<"Your are Seventeen, You can Enter"<<endl;
break;
case 18:
cout<<"Your are Eighteen, You can Enter"<<endl;
break;
default:
cout<<"Your have not permition to Enter, Just 15 to 18 year old can be enter."<<endl;
break;
}
return 0;
}

Comments
Post a Comment