#include<iostream.h>
#include<conio.h>
class hostel_mangt
{
public:
int x,h,id,rc,hd;
char name[15],dol[10];
void oprt_1()
{
cout<<"do u want to see or update room's ?"<<endl;
cout<<"enter 1 to see and 0 to do operations = "<<endl;
cin>>h;
}
void display_1()
{
if(h==1)
{
if (name==NULL)
{
cout<<"room is empty "<<endl;
}
else
{
cout<<"id = "<<id<<endl;
cout<<"name = "<<name<<endl;
cout<<"date of leaving = "<<dol<<endl;
}
else
{
cout<<" 1. Update the room member and its data "<<endl;
cout<<" 2. delete the room member and its data "<<endl;
cout<<"enter choice = " ;
cin>>x;
switch(x)
{
case 1:
{
cout<<"what do u want to update ? ";<<endl
cout<<" 1. name "<<endl;
cout<<" 2. date of leaving"<<endl;
cin>>rc;
switch(rc)
{
case 1:
{
cout<<"enter new name = "<<endl;
cin>>name;
}
case 2:
{
cout<<"enter updated date of leaving = ";
cin >>date;
}
}
break;
}
case 2:
{
cout<<"what do you want to be deleted = ";
cout<<" 1. name "<<endl;
cout<<" 2. date of leaving "<<endl;
cin>>hd;
switch(hd)
{
case 1:
{
name==NULL;
break;
}
case 2:
{
dol==NULL;
break;
}
break;
}
}
}
int main()
{
public:
int i,c;
clrscr();
hostel_mangt hm[10];
for(i=0;i<10;i++)
{
hm.oprt_1();
hm.display_1();
cout<<"do u want to continue ? "<<endl<<"if yes enter 1"<<endl;
cin>>c;
if(c!=1)
{
break;
}
}
getch();
return 0:
}
i am using turbo c
i am making a project named hostel management using classes ,array of objects,and switch case because hostel rooms can be empty but if i used normal array,stack,queue it wont work as it does can not have null value in middle