Lab 8 task_solution
Lab 8 task_solution
int main()
{
char ch;
cout<<"enter a cahracter to check it is vowel or not \n";
cin>>ch;
switch(ch)
{
case 'a': case'A':
cout<<ch<<"is vowel";
break;
case 'e':case'E':
cout<<ch<<"is vowel";
break;
case 'i':case'I':
cout<<ch<<"is vowel";
break;
case 'o':case 'O':
cout<<ch<<"is vowel";
break;
case 'u':case'U':
cout<<ch<<"is vowel";
break;
default:
cout<<"the character
entered is not a vowel \n";
}
return 0;
}
int main()
char selection;
char ch='y';
int a,b,c,d,e;
cout<<"\n Menu";
cout<<"\n========";
while(ch=='y')
{
cout<<"\n Enter selection: ";
cin>>selection;
switch(selection)
case 'A' :
cout<<"enter 5 numbers\n";
float avg;
cin>>a>>b>>c>>d>>e;
avg=(a+b+c+d+e)/5;
break;
case 'M' :
cout<<"enter 5 numbers\n";
int median;
//int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
median=(a+b+c+d+e)/2 +1;
break;
case 'B' :
case 'b' :
int remain;
int sum=0,a=1;
int x;
cin>>x;
do
sum+=(x%2)*a;
x=x/2;
a=a*10;
}
while(x!=0);
break;
case 'O' :
case 'o' :
int x;
cin>>x;
if(x%2==0)
else
break;
cout<<"\n";
cout<<"Do you want to perform another ? press y if yes \n";
cin>>ch;
return 0;