PROGRAM ON USING SWITCH STATEMENT
#include<iostream.h>
#include<conio.h>
void main()
{
int i=0,ua=0,ub=0,uc=0,fail=0;
clrscr();
while(i<=5)
{
switch(i++)
{
case 1:
case 2: ++ua;
case 3:
case 4: ++ub;
case 5: ++uc;
default: ++fail;
}
}
cout<<"ua="<<ua<<"\t"<<"ua="<<ub<<endl;
cout<<"uc="<<uc<<"\t"<<"fail="<<fail<<endl;
getch();
}
#include<conio.h>
void main()
{
int i=0,ua=0,ub=0,uc=0,fail=0;
clrscr();
while(i<=5)
{
switch(i++)
{
case 1:
case 2: ++ua;
case 3:
case 4: ++ub;
case 5: ++uc;
default: ++fail;
}
}
cout<<"ua="<<ua<<"\t"<<"ua="<<ub<<endl;
cout<<"uc="<<uc<<"\t"<<"fail="<<fail<<endl;
getch();
}
Comments
Post a Comment