{
system("color 74");
int a;
int choice;
char again;
char x[20];
cout<<endl;
cout<<" *** Welcome to the UCC Hotel Reservation Application ****"<<endl;
cout<<endl;
default:
cout<<"you have enter an invalid Choice "<<endl;
cout<<endl;
}
cout<<"Press 1 to go back into MAIN Menu or 0 to terminate the program: ";
cin>>again;
cout<<"_____"<<endl;
cout<<endl;
}
while (again=='1');
cout<<"Thankyou! for using Hotel Reservation application."<<endl;
cout<<"Have a nice day! "<<endl;
cout<<endl;
cout<<"Copyright(C) 2015. programming passion"<<endl;
cout<<endl;
cout<<"___________"<<endl;
//....................................................................//
void user_total() //funtion definition of function user_total
{
int choice,days,total1;
char AC,again;
int c=1000;
int single= 3000;
int doubl=4500;
int suit=6000;
int time=24;
int service=300;
do
{
cout<<"Which kind of Room did the guest stayed in? "<<endl;
cout<<endl;
cout<<" 1.Single Rooms "<<endl;
cout<<endl;
cout<<" 2.Double Rooms "<<endl;
cout<<endl;
cout<<" 3.Suits "<<endl;
cout<<endl;
cout<<"Select 1,2 or 3 . "<<endl;cout<<endl;cout<<"Enter Your CHoice Here_: ";cin>>choice;cout<<"__________________________________"<<endl;switch(choice){case1:cout<<"You have Selected single room. "<<endl;cout<<endl;cout<<" For How many days did the guest stayed: ";cin>>days;cout<<endl;cout<<" Press Y for A/c and N for without A/c: ";cin>>AC;cout<<endl;if(AC=='Y'||AC=='y')
{
total1 =(c+single+time+service)*days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"______"<<endl;
}
else if (AC == 'N' || AC == 'n')
{
total1=(single+time+service) * days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"_______"<<endl;
}
break;
case 2:
cout<<"You Have Selected Double room."<<endl;
cout<<endl;
cout<<" For How many days did the guest stayed: ";
cin>>days;
cout<<endl;
cout<<" Press Y for A/c and N for without A/c: ";
cin>>AC;
cout<<endl;
if(AC=='Y'||AC=='y')
{
total1 =(c+doubl+time+service)days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"______"<<endl;
}
else if (AC == 'N' || AC == 'n')
{
total1=(doubl+time+service) * days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"_______"<<endl;
}
break;
case 3:
cout<<"You Have Selected Suit. "<<endl;
cout<<endl;
cout<<" For How many days did the guest stayed: ";
cin>>days;
cout<<endl;
cout<<" Press Y for A/c and N for without A/c: ";
cin>>AC;
cout<<endl;
if (AC == 'Y' || AC == 'y')
{
total1 =(c+suit+time+service)days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"_________"<<endl;
}
else if (AC == 'N' || AC == 'n')
{
total1=(suit+time+service) * days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
}
break;
default:
cout<<"you have enter an invalid Choice "<<endl;
cout<<endl;
}
cout<<"Do you want to checkout for another room? (Y/N): ";
cin>>again;
cout<<"_____"<<endl;
cout<<endl;
}
while(again == 'y' || again == 'Y');
Nameguest;// guest is the name structureNameguest2;charchoicedo;//for enter more datado{ofstreamfile;file.open("User info input.txt",ios::out|ios::app);//openning txt file
if(!file)
{
cout<<"Error: Cannot open file.\n";
system("pause");
}
cout<<"Enter The Room # to be Reserved: ";cin>>guest.room;cin.ignore();// to skip the new line charactercout<<endl;cout<<"Enter Guest's First Name: ";cin.getline(guest.first,20);cout<<endl;cout<<"Enter Guest's Last Name: ";cin.getline(guest.last,20);cout<<endl;cout<<"Enter The Mobile no. of The Customer: +";cin.getline(guest.mob,20);cout<<endl;cout<<"The Name of Manager in Charge: ";cin.getline(guest2.first,20);cout<<endl;cout<<endl;cout<<"Date: ";cin.getline(guest.date,20);cout<<endl;inta;///for choice/////////////cout<<"Press 1 to Save or 2 to cancel: ";cout<<endl;
cin>>a;
if(a==1)
{
cout<<endl;
file<<" Guests Info"<<endl;
cout<<endl;
file<<"------------------------------------------------------------"<<endl;
file<<endl;
file<<" Reservation Data of Room no.: "<<guest.room<<endl;
file<<endl;
file<<"The Name of the Guest is: "<<guest.first<<" "<<guest.last<<endl;
file<<endl;
file<<"Mobile No.: +"<<guest.mob<<endl;
file<<endl;
file<<"CNIC No.: "<<guest.cnic<<endl;
file<<endl;
file<<"Name of Manager in Charge is: "<<guest2.first<<endl;
file<<endl;
file<<"Date: "<<guest.date<<endl;
file<<endl;
file<<endl;
file<<"------------------------------------------------------------"<<endl;
file.close();
cout<<"Record Saved..."<<endl;
cout<<"______"<<endl;
cout<<endl;
}
else
{
cout<<"Record Was Not Saved"<<endl;
cout<<"______"<<endl;
cout<<endl;
}
cout<<"Enter Y To input an other data or Enter N to Exit: ";
cin>>choicedo;
cout<<"_____"<<endl;
cout<<endl;
}
while (choicedo=='y' || choicedo=='Y'); //to enter more data
//}
}
void vacant_rooms() //function definition
{
ifstream infile,infile2,infile3; //ifstream for file reading
char name[89],name2[89],name3[89],name4[100];
int see;
char again;
do
{
cout<<"Press 1 to see the list of Single Rooms. "<<endl;
cout<<endl;
cout<<"Press 2 to See the list of Double Rooms. "<<endl;
cout<<endl;
cout<<"Press 3 to See the list of Suits. "<<endl;
cout<<endl;
cout<<"Enter Your Choice Here_: ";
cin>>see;
cout<<endl;
switch(see)
{
case 1:
infile.open("infoVS.txt",ios::in);
if (!infile)
{
cout<<"File not found."<<endl; exit(1);="" }="" else="" {="" while(!infile.eof())="" infile="">>name>>name2>>name3;
cout<<name<<" "<<name2<<" "<<name3<<endl;</endl;>
cout<<endl;
}
infile.close(); //closing the file
}
break;
case 2:
default:cout<<"You have entered an invalid choice"<<endl;cout<<endl;}cout<<"Do you want to see the List of vacant Rooms again? (Y/N): ";cin>>again;cout<<endl;
passward.getline(pass_file2, 50); // reading password from file 2
while (strcmp(pass_file1, pass_file2) !=0)
{
cout<<"\nPassword: ";
cin.getline(pass_file1, 50);
if (strcmp(pass_file1, pass_file2) ==0) //comparing the password
cout<<"\n\t Logged in Successfully!!!" <<endl<<endl<<endl;
else
Beep(3320,400);
cout<<"\nInvalid Password\n";
}
username.close(); // closing the file
passward.close(); // closing the file
}
//....................................................................//
//function definition ended
//....................................................................//
void check() /// function definition
{
chardoagain;do{fstreamdata;charword[100];data.open("Userinfoinput.txt",ios::in);cout<<endl;if(!data){cout<<"Filenotfound."<<endl;exit(1);}else{while(!data.eof()){data.getline(word,100);cout<<word<<"\n";data.getline(word,100);cout<<word<<"\n";data.getline(word,100);cout<<word<<"\n";data.getline(word,100);cout<<word<<"\n";}data.close();cout<<"Press Y to see the history again or N to cancel.";cin>>doagain;cout<<"___________________________________"<<endl;cout<<endl;}
void del_resdata() ///function definition
{
char again;
int x;
fstream deletefile;
do
{
cout<<"Enter 1 to delete the reservation data or 2 to cancel: ";
cin>>x;
cout<<endl;
if (x==1)
{
deletefile.open("User info input.txt", ios::out | ios::trunc); //trunc for delete data
if(!deletefile)
{
cout<<"File not found."<<endl;
exit(1);
}
else
{
cout<<"Data has been deleted from the file."<<endl;
cout<<endl;
}
}
else
{
cout<<"Data not deleted.."<<endl;
cout<<endl;
}
cout<<"Enter Y to run this function again or N to cancel: ";
cin>>again;
cout<<endl;
cout<<"______"<<endl;
}
while (again=='Y' || again=='y');
deletefile.close();
}
void about()
{
cout<<"About the Application"<<endl;
cout<<"_____"<<endl;
cout<<endl;
cout<<"This application is specially made for Hotel Reservation to "<<endl;
cout<<"Organize data and to perform tasks, which can be useful for "<<endl;
cout<<"Reservation.It can recored and analyze data of guests.With "<<endl;
cout<<"this application you can not only see the past history of "<<endl;
cout<<"guests,stayed in the hotel but you can also reserve rooms "<<endl;
cout<<"for the future as well.You can also calculate the bill of "<<endl;
cout<<"guests on the basis of time they have spent in the hotel "<<endl;
cout<<endl;
cout<<"this application.Thank you!"<<endl;
cout<<endl;
cout<<"UCC Prog 1 Class 2017"<<endl;
cout<<"__________"<<endl;
}
void help()
{
cout<<endl;
cout<<"This application will work according to the desired entries by "<<endl;
cout<<"the user.The reservation data will be stored in a text file present "<<endl;
cout<<"where the application is located.If the text file is not present "<<endl;
cout<<"the program will not work properly and will terminate.Follow the "<<endl;
cout<<"displayed on the screen.Select the proper option to operate "<<endl;
cout<<"instructions the application.Goodluck! "<<endl;
cout<<endl;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, im new here. looking for some help.
Im trying to create a user name and password for the code below. im new to programing. pls help.
include<iostream></iostream>
include<fstream></fstream>
include<windows.h></windows.h>
include<string></string>
include <conio.h></conio.h>
using namespace std;
int main()
{
system("color 74");
int a;
int choice;
char again;
char x[20];
cout<<endl;
cout<<" *** Welcome to the UCC Hotel Reservation Application ****"<<endl;
cout<<endl;
default:
cout<<"you have enter an invalid Choice "<<endl;
cout<<endl;
}
cout<<"Press 1 to go back into MAIN Menu or 0 to terminate the program: ";
cin>>again;
cout<<"_____"<<endl;
cout<<endl;
}
while (again=='1');
cout<<"Thankyou! for using Hotel Reservation application."<<endl;
cout<<"Have a nice day! "<<endl;
cout<<endl;
cout<<"Copyright(C) 2015. programming passion"<<endl;
cout<<endl;
cout<<"___________"<<endl;
//....................................................................//
//....................................................................//
void user_total() //funtion definition of function user_total
{
int choice,days,total1;
char AC,again;
int c=1000;
int single= 3000;
int doubl=4500;
int suit=6000;
int time=24;
int service=300;
do
{
cout<<"Which kind of Room did the guest stayed in? "<<endl;
cout<<endl;
cout<<" 1.Single Rooms "<<endl;
cout<<endl;
cout<<" 2.Double Rooms "<<endl;
cout<<endl;
cout<<" 3.Suits "<<endl;
cout<<endl;
{
total1 =(c+single+time+service)*days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"______"<<endl;
}
else if (AC == 'N' || AC == 'n')
{
total1=(single+time+service) * days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"_______"<<endl;
}
break;
case 2:
cout<<"You Have Selected Double room."<<endl;
cout<<endl;
cout<<" For How many days did the guest stayed: ";
cin>>days;
cout<<endl;
cout<<" Press Y for A/c and N for without A/c: ";
cin>>AC;
cout<<endl;
{
total1 =(c+doubl+time+service)days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"______"<<endl;
}
else if (AC == 'N' || AC == 'n')
{
total1=(doubl+time+service) * days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"_______"<<endl;
}
break;
case 3:
cout<<"You Have Selected Suit. "<<endl;
cout<<endl;
cout<<" For How many days did the guest stayed: ";
cin>>days;
cout<<endl;
cout<<" Press Y for A/c and N for without A/c: ";
cin>>AC;
cout<<endl;
if (AC == 'Y' || AC == 'y')
{
total1 =(c+suit+time+service)days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
cout<<endl;
cout<<"_________"<<endl;
}
else if (AC == 'N' || AC == 'n')
{
total1=(suit+time+service) * days;
cout<<"Your Total Total bill + service tax = ("<<total1<<" Rs.)"<<endl;
}
break;
default:
cout<<"you have enter an invalid Choice "<<endl;
cout<<endl;
}
cout<<"Do you want to checkout for another room? (Y/N): ";
cin>>again;
cout<<"_____"<<endl;
cout<<endl;
}
while(again == 'y' || again == 'Y');
{
if(!file)
{
cout<<"Error: Cannot open file.\n";
system("pause");
}
cin>>a;
if(a==1)
{
cout<<endl;
file<<" Guests Info"<<endl;
cout<<endl;
file<<"------------------------------------------------------------"<<endl;
file<<endl;
file<<" Reservation Data of Room no.: "<<guest.room<<endl;
file<<endl;
file<<"The Name of the Guest is: "<<guest.first<<" "<<guest.last<<endl;
file<<endl;
file<<"Mobile No.: +"<<guest.mob<<endl;
file<<endl;
file<<"CNIC No.: "<<guest.cnic<<endl;
file<<endl;
file<<"Name of Manager in Charge is: "<<guest2.first<<endl;
file<<endl;
file<<"Date: "<<guest.date<<endl;
file<<endl;
file<<endl;
file<<"------------------------------------------------------------"<<endl;
file.close();
cout<<"Record Saved..."<<endl;
cout<<"______"<<endl;
cout<<endl;
}
else
{
cout<<"Record Was Not Saved"<<endl;
cout<<"______"<<endl;
cout<<endl;
}
cout<<"Enter Y To input an other data or Enter N to Exit: ";
cin>>choicedo;
cout<<"_____"<<endl;
cout<<endl;
}
while (choicedo=='y' || choicedo=='Y'); //to enter more data
//}
}
//....................................................................//
void vacant_rooms() //function definition
{
ifstream infile,infile2,infile3; //ifstream for file reading
char name[89],name2[89],name3[89],name4[100];
int see;
char again;
do
{
cout<<"Press 1 to see the list of Single Rooms. "<<endl;
cout<<endl;
cout<<"Press 2 to See the list of Double Rooms. "<<endl;
cout<<endl;
cout<<"Press 3 to See the list of Suits. "<<endl;
cout<<endl;
cout<<"Enter Your Choice Here_: ";
cin>>see;
cout<<endl;
switch(see)
{
case 1:
infile.open("infoVS.txt",ios::in);
if (!infile)
{
cout<<"File not found."<<endl; exit(1);="" }="" else="" {="" while(!infile.eof())="" infile="">>name>>name2>>name3;
cout<<name<<" "<<name2<<" "<<name3<<endl;</endl;>
}
infile.close(); //closing the file
}
break;
case 2:
if(!infile2)
{
cout<<"File not found."<<endl; exit(1);="" }="" else="" {="" while(!infile2.eof())="" {<br="">infile2>>name>>name2>>name3;
cout<<name<<" "<<name2<<" "<<name3<<endl;
cout<<endl;
}
infile2.close();
}
break;</endl;>
case 3:
if(!infile3)
{
cout<<"File not found."<<endl;
exit(1);
}
else
{
}
}
break;
}while (again=='Y' || again=='y');
cout<<endl;
}
//....................................................................//
//....................................................................//
void login() //function calling
{
char log_file1[20], pass_file1[20];
char log_file2[20], pass_file2[20];
ifstream username,passward;
username.open("user.txt");
if(!username)
{
cout<<"File Not Found....";
exit(1);
}
passward.open("pass.txt");
if(!passward)
{
cout<<"File Not Found....";
exit(1);
}
// reading username from file 2....
username.getline(log_file2, 50);
while (strcmp(log_file1, log_file2))
{
cout<<"\nUser Name: ";
cin.getline(log_file1, 50);
if (strcmp(log_file1, log_file2) ==0) //comparing the username
break;
else
Beep(3320,400);
cout<<"\nInvalid Username.\n";
}
passward.getline(pass_file2, 50); // reading password from file 2
while (strcmp(pass_file1, pass_file2) !=0)
{
cout<<"\nPassword: ";
cin.getline(pass_file1, 50);
if (strcmp(pass_file1, pass_file2) ==0) //comparing the password
cout<<"\n\t Logged in Successfully!!!" <<endl<<endl<<endl;
else
Beep(3320,400);
cout<<"\nInvalid Password\n";
}
username.close(); // closing the file
passward.close(); // closing the file
}
//....................................................................//
//function definition ended
//....................................................................//
void check() /// function definition
{
}
while (doagain=='y' || doagain=='Y');
}
//....................................................................//
void del_resdata() ///function definition
{
char again;
int x;
fstream deletefile;
do
{
cout<<"Enter 1 to delete the reservation data or 2 to cancel: ";
cin>>x;
cout<<endl;
if (x==1)
{
deletefile.open("User info input.txt", ios::out | ios::trunc); //trunc for delete data
if(!deletefile)
{
cout<<"File not found."<<endl;
exit(1);
}
else
{
cout<<"Data has been deleted from the file."<<endl;
cout<<endl;
}
}
else
{
cout<<"Data not deleted.."<<endl;
cout<<endl;
}
cout<<"Enter Y to run this function again or N to cancel: ";
cin>>again;
cout<<endl;
cout<<"______"<<endl;
}
while (again=='Y' || again=='y');
deletefile.close();
}
void about()
{
cout<<"About the Application"<<endl;
cout<<"_____"<<endl;
cout<<endl;
cout<<"This application is specially made for Hotel Reservation to "<<endl;
cout<<"Organize data and to perform tasks, which can be useful for "<<endl;
cout<<"Reservation.It can recored and analyze data of guests.With "<<endl;
cout<<"this application you can not only see the past history of "<<endl;
cout<<"guests,stayed in the hotel but you can also reserve rooms "<<endl;
cout<<"for the future as well.You can also calculate the bill of "<<endl;
cout<<"guests on the basis of time they have spent in the hotel "<<endl;
cout<<endl;
cout<<"this application.Thank you!"<<endl;
cout<<endl;
cout<<"UCC Prog 1 Class 2017"<<endl;
cout<<"__________"<<endl;
}
void help()
{
cout<<endl;
cout<<"This application will work according to the desired entries by "<<endl;
cout<<"the user.The reservation data will be stored in a text file present "<<endl;
cout<<"where the application is located.If the text file is not present "<<endl;
cout<<"the program will not work properly and will terminate.Follow the "<<endl;
cout<<"displayed on the screen.Select the proper option to operate "<<endl;
cout<<"instructions the application.Goodluck! "<<endl;
cout<<endl;
}