Professional Documents
Culture Documents
Houses()
{
house++;
num = house;
owned = 0;
cout << "\t\t\t\t House No. " << num << endl;
}
void display_house()
{
class Streets
{
protected:
static int street;
Houses* H;
int num,size;
public:
Streets()
{
street++;
num = street;
cout << "\t\t\t Street No. " << num << endl;
cout << "Enter number of Houses :: ";
cin >> size;
this->H = new Houses[this->size];
}
void display_street()
{
cout << "\t\t\t Street No. " << num << endl;
class Sectors
{
protected:
static char sector;
char num;
int size;
Streets* Str;
public:
Sectors()
{
sector++;
num = sector;
cout << "\t\t Sector " << num << endl;
cout << "Enter number of Streets :: ";
cin >> size;
this->Str = new Streets[this->size];
void display_sector()
{
cout << "\t\tSector " << num << endl;
class Blocks
{
protected:
static char block;
char num;
int size;
Sectors* S;
public:
Blocks()
{
block++;
num = block;
cout << "\t\t Block " << num << endl;
cout << "Enter number of sectors :: ";
cin >> size;
this->S = new Sectors[this->size];
}
void display_blocks()
{
cout << "Block " << num << endl;
for (int i = 0; i < size; i++)
{
S[i].display_sector();
}
}
void AddOwner(char sector , int street ,int house ,string owner_name)
{
cout << "Enter Sector number: ";
// char sector;
cin >> sector;
int s = sector - 'A';
S[s].AddOwner(street , house , owner_name);
}
};
int Houses::house = 0;
int Streets::street = 0;
char Sectors::sector = 64;
char Blocks::block = 64;
class Society
{
private:
string soci, city;
int size;
Blocks* B;
public:
Society()
{
cout << "Enter Name of Society ";
getline(cin, soci);
cout << "Enter name of City ";
getline(cin, city);
cout << "Enter number of blocks ";
cin >> size;
this->B = new Blocks[this->size];
void display()
{
cout << "\n\n*******************************************"<<endl;
cout << soci << "\t" << city << endl;
for (int i = 0; i < size; i++)
{
B[i].display_blocks();
}
}
void set(char block , char sector , int street, int house, string owner_name)
{
cout << "************************************************"<<endl;
cout <<"Enter Address to allocate house to owner" << endl;
cout << "Block name: ";
//char block;
cin >> block;
int b = block - 'A';
B[b].AddOwner(sector, street , house , owner_name);
}
};
int main()
{
char block , sector , ter, ter1;
int street, house ,size ;
string owner_name;
do{
Society society;
do{
cout <<"\nEnter number of owners do you want to Allocate houses";
cin >> size;
for (int i=0 ;i < size; i++ )
{
society.set( block , sector , street , house ,owner_name );
}
cout <<"If you have finish setting the Owners"<<endl;
cout <<"Then press 't' or 'T' "<< endl;
cout <<"Or if you want to enter more press any other key" << endl;
cin >> ter;
}while( ter!='t' && ter!='T' );
society.display();
cout <<"If you want to terminate Program then press T or t" << endl;
cin >> ter1;
}while ( ter1!='t' && ter1!='T' );