#include <iostream>
#include <conio.h>
#include <fstream.h>
using namespace std;
main()
{
char name[25],address[50];
int inmonth,inday,room,outmonth,outday,contactno;
string user,pass;
int payment;
int menu;
for(int atmp=0;atmp >-3;atmp--){
cout<<"Attempt(s): "<<atmp+3<<endl<<endl;
cout<<"Username: ";
cin>>user;
cout<<"Password: ";
cin>>pass;
if((user == "group2")||(pass=="adminpass")){
break;
}
else{
cout<<"Wrong Password"<<endl<<endl;
}
if(atmp == -2){
cout<<"Exiting Program.... To many attempts";
getch();
return 0;
}
}
system("cls");
cout<<"\t\tLogin Approved!!!!"<<endl<<endl;
cout<<"Press Any Key to Continue";
getch();
system("cls");
cout<<"\n\n\n\t\t Hotel Reservation Menu"<<endl;
cout<<"1 = Booking"<<endl;
cout<<"2 = Cancelation of Reservation"<<endl;
cout<<"3 = Exit Program"<<endl;
cin>>menu;
if(menu == 1){
//Time In
cout<<" Hotel Reservation \n\n";
cout<<"Please Enter Costumer Name: ";
cin.getline(name,sizeof(name));
ifstream infile;
ofstream outfile;
outfile.open(name);
cout<<"Full Address; ";
cin.getline(address,sizeof(address));
cout<<"Contact no.; ";
cin>>contactno;
system("cls");
//In
cout<<"\n1 = January \t| 2 = February \t| 3 = March \t| 4 = April\n";
cout<<"5 = May \t| 6 = June \t| 7 = July \t| 8 = August\n";
cout<<"9 = September \t| 10 = October \t| 11 = November\t| 12 = December\n";
cout<<"Enter The (no.)Month of Reservation: ";
cin>>inmonth;
if ((inmonth>=13)||(inmonth<=0)){
cout<<"\n\n\t\t\tInvalid Input";
getch();
return 0;
}
if ((inmonth == 1)||(inmonth == 3)||(inmonth == 5)||(inmonth == 7)||(inmonth == 8)||(inmonth == 10)||(inmonth == 11)){
cout<<"Enter Day (1-31): ";
cin>>inday;
if ((inday<=0)||(inday>=32)){
cout<<"Invalid Input";
getch();
return 0;
}
}
else if (inmonth == 2){
cout<<"Enter Day (1-28/29): ";
cin>>inday;
if ((inday<=0)||(inday>=30)){
cout<<"Invalid Input";
getch();
return 0;
}
}
else
{
cout<<"Enter Day (1-30): ";
cin>>inday;
if ((inday<=0)||(inday>=31)){
cout<<"Invalid Input";
getch();
return 0;
}
}
system("cls");
cout<<"1 = Class S(5,200 per Day)\n2 = Class A (4,200 per Day)\n3 = Class B(3,200 per Day)";
cout<<"\nRoom Class[no]: ";
cin>>room;
if ((room >= 4)||(room <= 0)){
cout<<"Invalid Input";
cout<<"Exiting Program..... ";
getch();
return 0;
}
system("cls");
//Costumer Details Review
cout<<"Costumer name: "<<name<<endl;
cout<<"Address: "<<address<<endl;
cout<<"Contact no.: "<<contactno<<endl;
if (room == 1){
cout<<"Room: Class S";
}
else if (room == 2){
cout<<"Room: Class A";
}
else if (room == 3){
cout<<"Room: Class B";
}
else {
cout<<"no Room";
}
cout<<"Balance: "<<payment;
// Hotel Reservation Save
outfile<<"Costumer name: "<<name<<endl;
outfile<<"Address: "<<address<<endl;
outfile<<"Contact no.: "<<contactno<<endl;
if (room == 1){
outfile<<"Room: Class S"<<endl;
}
else if (room == 2){
outfile<<"Room: Class A"<<endl;
}
else if (room == 3){
outfile<<"Room: Class B"<<endl;
}
else {
outfile<<"no Room";
}
outfile<<"Balance: "<<payment;
outfile.close();
}
else if (menu == 2){
cout<<"Please Enter the name of Costumer";
cin.getline(name,sizeof(name));
cout<<"Are You Sure to Cancel this Reservation ( Y = Yes )
}
else if (menu == 3){
cout<<"Please Any Key to Continue";
}
else{
cout<<"Invalid Input";
}
getch();
return 0;
}