viewing paste Unknown #21531 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
#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;
 
}
 
Viewed 492 times, submitted by unknown.