Hello people this is very urgent!
i have to make a hotel management programme and submit by tommorow,
i have made the programme but it got rejected cause i used calsses for the log in.
Can u people please help me by telling me another way to write a password..
and if u guys have any other good idea please add it into the code. Here is the code please can u add the password thingy and if u guys have anyother good idea, but it has to be simple that is if and else statements and cstring.. please help me!
code :-
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
class Password /* Password class... will store all necessary data */
{
protected: /* A password should be protected*/
string password; /* The string to store the password */
string input; /* The string to store the input */
public:
Password (string pass) {this->password = pass;}
/* Get the password from the user */
void Input ()
{
while (true) /* Infinite loop, exited when RETURN is pressed */
{
char temp;
/* Get the current character of the password */
temp= getch ();/* Get the current character of the password */
if (GetAsyncKeyState (VK_RETURN)) /* If the user has pressed return */
return;/* Exit the function */
input += temp;
cout << '*'; /* Print a star */
}
}
bool Compare () /* Check if the input is the same as the password */
{
if (password.length() != input.length()) /* If they aren't the same length */
return false; /* Then they aren't the same! */
for (unsigned int i = 0; i <= input.length(); i++)
{ /* Loop through the strings */
if (password[i] != input[i])
return false; /* If anything is not a match, then they are not the same */
}
return true;/* then they are the same */
}
};
int main ()
{
system("title HOTEL MANAGER");
MessageBeep(MB_ICONEXCLAMATION);
MessageBox( 0, "Welcome To BLOOM HOTEL MANAGER", "Welcome Message!", MB_SETFOREGROUND );
MessageBeep(MB_ICONASTERISK);
int code;
int d;
int costdays;
int room;
int costroom;
int costrooms;
int food;
int costfood;
int totalcost;
int accost;
int compGuess = rand() % 100 +1; //Generates number between 1 - 100
int highestNumber = 100;
int lowestNumber = 1;
string rt;
string fc;
string ac;
//this is the hotel manager code for the epicness!!!
//we are the epicest!
//this is made only by vikram but also given credit to some partner
//this is fun
//zoooweemama
cout<<" -=****BLOOM HOTEL MANAGER****=-\n\n";
cout<<"*****************************************************************************************************************************\n\n\n";
cout<<"PASSCODE:- ";
Password pass ("bloom"); /* Assigned the password with a value*/
pass.Input ();/* Get the input from the user */
if (pass.Compare()){/* If they match, user would get access to next page */
cout << "\n\n\n Press Enter To Continue ";
cin.ignore();
system("CLS");
cout<<" -=****BLOOM HOTEL MANAGER****=-\n\n";
cout<<"*****************************************************************************************************************************\n\n\n";
cout<<" ********************";
cout<<"\n 1) BOOK A ROOM\n";
cout<<" ********************";
cout<<"\n 3) EXIT MANAGER\n";
cout<<" ********************\n\n\n";
cout<<" SELECT ACTION:- ";
cin>>code;
if (code == 1){
system("CLS");
cout<<" -=****BLOOM HOTEL MANAGER****=-\n\n";
cout<<"*****************************************************************************************************************************\n\n\n";
cout<<"\n BOOK A ROOM";
cout<<"\n\n\n\n\n Number Of Days:- \n\n";
cout<<" Number Of Days between 1- 30\n\n";
cin>>d;
system("CLS");
if (d > 30){
cout<<" INVALID ID\n\n\n";
}
else if (d < 1){
cout<<" INVALID ID\n\n\n";
}
cout<<" -=****BLOOM HOTEL MANAGER****=-\n\n";
cout<<"*****************************************************************************************************************************\n\n\n";
cout<<"\n BOOK A ROOM";
cout<<"\n\n\n\n\n ROOM TYPE:- ";
cout<<" \n\n 1) Delux Room 2) V.I.P Room 3) Suite\n\n";
cin>> room;
if (room == 1) {
costroom = d*500;
rt = "Delux Room";
system("CLS");
}
else if (room == 2) {
costroom = d*1000;
rt = "VIP Room";
system("CLS");
}
else if (room == 3) {
costroom = d*5000;
rt = "Suite";
system("CLS");
}
else {
cout<<" INVALID ID";
system("CLS");
main();
}
cout<<" -=****BLOOM HOTEL MANAGER****=-\n\n";
cout<<"*****************************************************************************************************************************\n\n\n";
cout<<"\n FOOD";
cout<<"\n\n\n\n\n INCLUDE FOOD:-";
cout<<"\n\n Include Lunch, Dinner, Breakfast";
cout<<"\n\n\n Yes(1) / No(2) :- ";
cin>>food;
if (food == 1){
costfood = 200;
fc = "Yes";
system("CLS");
}
else if (food == 2){
costfood = 0;
fc = "No";
system("CLS");
}
else {
cout<<" INVALID ID";
system("CLS");
main();
}
cout<<" -=****BLOOM HOTEL MANAGER****=-\n\n";
cout<<"*****************************************************************************************************************************\n\n\n";
cout<<"\n AC / Non-AC";
cout<<"\n\nDo You Want An AC room Yes(1) / No(2)";
cin>>accost;
if (accost == 1){
ac = "Yes";
costrooms = costroom + 632;
system("CLS");
}
else if (accost == 2){
ac = "No";
costrooms = costroom + 12;
system("CLS");
}
cout<<" -=****BLOOM HOTEL MANAGER****=-\n\n";
cout<<"*****************************************************************************************************************************\n\n\n";
cout<<"\n YOUR TOTAL COST\n\n\n";
totalcost = costfood + costrooms + 10;
cout<<" ROOM TYPE:- "<<rt;
cout<<"\n----------------------------------------------------------------------------------------------------------------------------------\n";
cout<<"\nNumber Of Days:- "<<d;
cout<<"\n----------------------------------------------------------------------------------------------------------------------------------\n";
cout<<"\nFood Included:- "<<fc;
cout<<"\n\n--------------------------------------------------------------------------------------------------------------------------------\n";
cout<<"\nAc / Non-Ac:- "<<ac;
cout<<"\n\n--------------------------------------------------------------------------------------------------------------------------------\n";
cout<<"\nYour Room Number is:-"<< compGuess;
cout<<"\n\n--------------------------------------------------------------------------------------------------------------------------------\n";
cout<<" Your Total Cost Is:- "<<totalcost;
cout<<"\n*****************************************************************************************************************************\n\n\n";
cout<<" ** WE THANK YOU FOR BOOKING A ROOM AT BLOOM HOTEL **\n\n";
cin.ignore();
MessageBox( 0, "Made by :-\nVikram Sehgal, Vaishanavi Diwedi and Pryanshu Sinha", "", MB_OK );
cin.ignore();
system("CLS");
main();
}
else if (code == 3){
cout<<"\n\n\n*****************************************************************************************************************************\n\n\n";
cout<<" **THANK YOU**\n\n\n";
}
}
else{
cout << "\n\n\n The Passcode Entered Is Wrong Please Contact The Hotel Administrator.";
cin.ignore();/* if wrong the programme will close*/
}
cin.get ();/* Pause for input */
return EXIT_SUCCESS;/* Program was executed successfully */
}
i have added comments for help ! please edit the programme and reply back and post it! i have only 12 hrs from now left.