#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
struct room
{
char type[3];
int rmn;
int terrif;
};
void add(room *,int);
void main()
{
clrscr();
int n,r,modifychoice,c,a,i;
room rm[5];
cout<<endl<<endl;
while(1)
{
cout<<"\t\t\t"<<"HOTEL DAVIANS"<<endl<<endl;
cout<<"\t\t "<<"MENU FOR HOTEL DAVIANS -"<<endl;
cout<<"\t\t"<<"1. Enter rooms record for the hotel "<<endl;
cout<<"\t\t"<<"2. Modify rooms records"<<endl;
cout<<"\t\t"<<"3. Check room records"<<endl;
cout<<"\t\t"<<"4. Exit"<<endl<<endl<<endl;
cout<<"enter choice: ";
cin>>n;
switch(n)
{
case 1: cout<<"enter no. of rooms in the hotel at present: ";
cin>>r;
for(int i=0;i<r;i++)
{
cout<<"Details of room no."<<i+1<<endl;
cout<<"Room no.: ";
cin>>rm[i].rmn;
cout<<"Room type: ";
gets(rm[i].type);
fflush(stdin);
cout<<"Room terrif";
cin>>rm[i].terrif;
}
break;
case 2:cout<<"Enter room no. to be modified: ";
cin>>i;
i=i-1;
clrscr();
while(1)
{
cout<<endl<<endl;
cout<<"\t\t"<<"1. Change room no."<<endl;
cout<<"\t\t"<<"2. Change room terrif"<<endl<<endl<<endl;
cout<<"\t\t"<<"Enter choice: ";
cin>>modifychoice;
if(modifychoice<3)
{
switch(modifychoice)
{
case 1:cout<<"Enter new room no.: ";
cin>>rm[i].rmn;
break;
case 2:cout<<"Enter new room terrif: ";
cin>>rm[i].terrif;
break;
default: cout<<"false option";
}
break;
}
clrscr();
}
case 3:cout<<"Enter room no. whose record u want to see: ";
cin>>a;
i=a-1;
cout<<"Room no. is: "<<rm[i].rmn<<endl;
cout<<"Room type is: ";
puts(rm[i].type);
cout<<endl;
cout<<"Room terrif is: "<<rm[i].terrif;
break;
case 4:exit(0);
default: cout<<"false option" ;
}
clrscr();
}
getch();
}
Archit Gupta 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.