#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class counter
{
int
count;
public:
counter()
{
count=0;
}
void
incount()
{
count++;
}
int
givecount()
{
return
(count);
}
}c1,c2,c3;
void main()
{
clrscr();
char
guest[10];
int
i,a,b,c;
for(i=0;i<10;i++)
{
cout<<"enter
gntlmn(g),ladies(l),chldrn(c) "<<endl;
cin>>guest[i];
if(guest[i]=='g'||guest[i]=='G')
{
c1.incount();
a=c1.givecount();
}
else
if(guest[i]=='l'||guest[i]=='L')
{
c2.incount();
b=c2.givecount();
}
else
{
c3.incount();
c=c3.givecount();
}
}
cout<<"GENTLEMEN :"<<a<<endl;
cout<<"LADIES :"<<b<<endl;
cout<<"CHILDREN :"<<c<<endl;
getch();
}
OUTPUT:
enter gntlmn(g),ladies(l),chldrn(c)
c
enter gntlmn(g),ladies(l),chldrn(c)
g
enter gntlmn(g),ladies(l),chldrn(c)
l
enter gntlmn(g),ladies(l),chldrn(c)
g
enter gntlmn(g),ladies(l),chldrn(c)
l
enter gntlmn(g),ladies(l),chldrn(c)
l
enter gntlmn(g),ladies(l),chldrn(c)
l
enter gntlmn(g),ladies(l),chldrn(c)
l
enter gntlmn(g),ladies(l),chldrn(c)
c
enter gntlmn(g),ladies(l),chldrn(c)
c
GENTLEMEN :2
LADIES :5
CHILDREN :3
No comments:
Post a Comment