You are on page 1of 4

#include<iostream.

h>

#include<conio.h>
#include<process.h>
#include<string.h>
class society{
char socname[25];
int houseno;
int noofmem;
char flat[3];
float income;
void allocate()
{if(income>=1000)
strcpy(flat,"HIG");
else if(income>=5000)
strcpy(flat,"MIG");
else if(income<5000)
strcpy(flat,"LIG");
}
public:
void getdata()
{cout<<"name of society";
cin>>socname;
cout<<"house no";
cin>>houseno;
cout<<"no of members";
cin>>noofmem;
cout<<"monthly income";
cin>>income;
}
void display()
{
allocate();
cout<<"name of society"<<socname<<endl;
cout<<"house name"<<houseno<<endl;
cout<<"no of members"<<noofmem<<endl;
cout<<"flat type"<<flat<<endl;
cout<<"income"<<income<<endl;
}
};
void main()
{clrscr();
int choice,a;
society A[10];
do{
cout<<"choose: \n 1.for entering 2.for displaying";
cin>>choice;
switch(choice)
{
case 1:cout<<"enter no of customers";
cin>>a;
for(int i=0;i<a;i++)
A[i].getdata();
break;

case 2:for(i=0;i<a;i++)
A[i].display();
break;
}
}while(choice!=3);
getch();
}
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<string.h>
class society{
char socname[25];
int houseno;
int noofmem;
char flat[3];
float income;
void allocate()
{if(income>=1000)
strcpy(flat,"HIG");
else if(income>=5000)
strcpy(flat,"MIG");
else if(income<5000)
strcpy(flat,"LIG");
}
public:
void getdata()
{cout<<"name of society";
cin>>socname;
cout<<"house no";
cin>>houseno;
cout<<"no of members";
cin>>noofmem;
cout<<"monthly income";
cin>>income;
}
void display()
{
allocate();
cout<<"name of society"<<socname<<endl;
cout<<"house name"<<houseno<<endl;
cout<<"no of members"<<noofmem<<endl;
cout<<"flat type"<<flat<<endl;
cout<<"income"<<income<<endl;
}
};
void main()
{clrscr();
int choice,a;
society A[10];
do{
cout<<"choose: \n 1.for entering 2.for displaying";

cin>>choice;
switch(choice)
{
case 1:cout<<"enter no of customers";
cin>>a;
for(int i=0;i<a;i++)
A[i].getdata();
break;
case 2:for(i=0;i<a;i++)
A[i].display();
break;
}
}while(choice!=3);
getch();
}
choose:
1.for entering 2.for displaying
1
enter no of customers
1
name of society
Vega
house no
123
no of members
2
monthly income
12000
choose:
1.for entering 2.for displaying
2
name of society Vega
house name 123
no of members 2
flat type HIG
income 12000

enter no of customers
1
name of society
Vega
house no
123
no of members
2
monthly income
12000
choose:
1.for entering 2.for displaying
2
name of society Vega
house name 123
no of members 2
flat type HIG
income 12000
choose:
1.for entering 2.for displaying
3

choose:
1.for entering 2.for displaying
3

choose:
1.for entering 2.for displaying
1

choose:
1.for entering 2.for displaying
1
enter no of customers
1
name of society
Vega

house no
123
no of members
2
monthly income
12000
choose:
1.for entering 2.for displaying
2
name of society Vega
house name 123
no of members 2
flat type HIG
income 12000
choose:
1.for entering 2.for displaying
3

1.for entering 2.for displaying


1
enter no of customers
1
name of society
Vega
house no
123
no of members
2
monthly income
12000
choose:
1.for entering 2.for displaying
2
name of society Vega
house name 123
no of members 2
flat type HIG
income 12000
choose:
1.for entering 2.for displaying
3

choose:

You might also like