• No results found

C++ Project on Hotel Room Reservation

N/A
N/A
Protected

Academic year: 2021

Share "C++ Project on Hotel Room Reservation"

Copied!
48
0
0

Loading.... (view fulltext now)

Full text

(1)

C

omputer Science

P

roject File

of

Ashwani Kumar Jha

XIIth-A

Board Roll No. ___________

(2)

Hotel Room Reservation

System

//header files included.

#include<fstream.h>

#include<conio.h>

#include<stdio.h>

(3)

#include<string.h>

#include<process.h>

#include<dos.h>

#include<ctype.h>

///////////////////////////////////////////////////////////////////////////////////////////////

date indate(int &);

int readcust(int &, char *, unsigned long &, unsigned long &,date &); void operate(); void roommenu(); void reserve(); void leaveroom(); void query(); void payme(); void querymenu(); void searchroom(); void searchcust(); void noocc(); void nounocc(); void nofrs(); void querymainmenu(); void updateroom(); void delroom(); void show_all_room(); void insertroom(); /////////////////////////////////////////////////////////////////////////////

//room class begins HERE. class room{

(4)

char rtype[20];

public:

int rstatus; //room no. & status int rno;

long double rate; room() { rstatus=0; } retstatus() { return rstatus; } char* retroomtype() { return rtype; }

void addroom() //To Add Room {

clrscr(); int c;

cout<<"\nRoom No.:\t"<<rno; cout<<"\nEnter Suite Type:"; cout<<"\n\n1. Single AC\n"; cout<<"2. Single NonAC\n"; cout<<"3. Double AC\n"; cout<<"4. Double NonAC\n"; cout<<"5. Luxury\n\n"; cin>>c;

switch(c) {

(5)

case 1:strcpy(rtype,"Single AC"); rate=3000;

break;

case 2:strcpy(rtype,"Single NonAC"); rate=2000;

break;

case 3:strcpy(rtype,"Double AC"); rate=6000;

break;

case 4:strcpy(rtype,"Double NonAC"); rate=4500;

break;

case 5:strcpy(rtype,"Luxury"); rate=9000;

break;

default: cout<<"Wrong Choice...!!"; }; getch(); clrscr(); } void modify() { clrscr(); int n;

cout<<"\nEnter New Suite Type:"; cout<<"\n\n1.Single AC\n"; cout<<"2.Single NonAC\n"; cout<<"3.Double AC\n"; cout<<"4.Double NonAC\n"; cout<<"5.Luxury\n"; cin>>n; switch(n) {

(6)

rate=3000; break;

case 2:strcpy(rtype,"Single NonAC"); rate=2000;

break;

case 3:strcpy(rtype,"Double AC"); rate=6000;

break;

case 4:strcpy(rtype,"Double NonAC"); rate=4500; break; case 5:strcpy(rtype,"Luxury"); rate=9000; break; } getch(); clrscr(); }

void showroom() //To Display Details of Room. { char rsta[15]; clrscr(); cout<<"\nRoom Number:\t"<<rno; cout<<"\nRoom Type :\t"; puts(rtype);

cout<<"\nRoom Rate :\t"<<"Rs."<<rate; if(rstatus==0) strcpy(rsta,"Unoccupied"); else strcpy(rsta,"Occupied"); cout<<"\nRoom Status:\t"; puts(rsta);

cout<<"\n\nPRESS ANY KEY TO CONTINUE !"; getch();

clrscr(); }

(7)

///////////////////////////////////////////////////// //cust class begins HERE.

class cust{

char room_type[20],cname[50],add[100],pno[11]; date check_in, check_out;

public: int room_no;

long double adamt,bal; char* retcname() { return cname; } retcustroom_no() { return room_no; } int input() { clrscr();

cout<<"\n\n\Enter Customer's Name :\t"; gets(cname);

cout<<"\n\nEnter Customer's Address :\t"; gets(add);

cout<<"\n\nEnter Customer's Phone Number:\t"; cin>>pno;

getdate(&check_in);

int f=readcust(room_no,room_type,adamt,bal,check_out); return(f);

(8)

void showcust() {

clrscr();

cout<<"\n\nCustomer Name :"; puts(cname);

cout<<"\nCustomers phone number:"; cout<<pno; cout<<"\nRoom No. :"; cout<<room_no; cout<<"\nRoom Type : "; puts(room_type); cout<<"\nTotal Rent : "; cout<<adamt+bal; cout<<"\nAdvance : "; cout<<adamt; cout<<"\nBalance : "; cout<<bal;

printf("\nThe Check in year is : %d\n", check_in.da_year); printf("\nThe Check in Month is: %d\n", check_in.da_mon); printf("\nThe Check in Date is : %d\n", check_in.da_day); printf("\nThe checkout year is : %d\n", check_out.da_year); printf("\nThe checkout Date is : %d\n", check_out.da_day); printf("\nThe checkout Month is: %d\n", check_out.da_mon);

getch(); clrscr(); }

}; //end of class cust.

//here, ask user for room type, no. of days to stay //also ask him to pay 50% of total rent in advance

(9)

{ room r; ifstream f;

unsigned long advance; int t,s;

int flag; struct date d;

cout<<"\n\nEnter The Type Of Suit Customer Wants:\t\n"; do{

void menu();

cout<<"\nEnter Suite Type:"; cout<<"\n 1.Single AC Rs.3000"; cout<<"\n 2.Single NonAC Rs.2000"; cout<<"\n 3.Double AC Rs.6000"; cout<<"\n 4.Double NonAC Rs.4500"; cout<<"\n 5.Luxury Rs.9000";

cout<<"\n\nIf You Don't Want to Continue, Press Any Other Number ! \n\n\t\t"; cin>>t; if(t>5 || t<1) return 1; char rtype[20]; switch(t) {

case 1:strcpy(rtype,"Single AC"); r.rate=3000;

break;

case 2:strcpy(rtype,"Single NonAC"); r.rate=2000;

break;

case 3:strcpy(rtype,"Double AC"); r.rate=6000;

break;

case 4:strcpy(rtype,"Double NonAC"); r.rate=4500;

break;

case 5:strcpy(rtype,"Luxury"); r.rate=9000;

(10)

break; } f.open("Room.dat" , ios::binary); if(!f) { cout<<"\n\t\t\tERROR !!"; return 1; } f.read((char*)&r , sizeof(r)); while(f) {

if(strcmp(rtype,r.retroomtype()) == 0 && r.retstatus() == 0) { r.rstatus=1; r.showroom(); break; } f.read((char*)&r , sizeof(r)); } if(f.eof()) { flag=1; clrscr();

cout<<"\n\nRoom Requested Is NOT AVAILABLE ! \n Please Enter Another Room Type !"; clrscr(); f.close(); } else { flag=0; } }while(flag!=0); d=indate(s); int rent=s*r.rate;

(11)

char a;

cout<<"\n\nYour Amount Payable is :\t"<<"Rs."<<rent<<"\n"; do{

cout<<"\nPlease pay 50% amount now :\t"<<"Rs."; cin>>advance;

cout<<"\n\nDo you want to stay(only y/n) : "; cin>>a; }while(advance<rent/2&& a=='y'); if(a=='y'&& advance>=rent/2) flag=0; else flag=1; clrscr(); room_no=r.rno; strcpy(type,r.retroomtype()); adm=advance; bal=rent-advance; check_out=d;

printf("\nThe current year is: %d\n", d.da_year); printf("\nThe current day is: %d\n", d.da_day); printf("\nThe current month is: %d\n", d.da_mon); clrscr(); return flag; } void custenter() { clrscr(); cust c; ofstream f("customer.dat",ios::binary|ios::app); if(!f) { cout<<"\nError..."; return; } if (c.input()==0)

(12)

f.write((char*)&c,sizeof(c)); f.close(); clrscr(); getch(); clrscr(); } void showcustomer() { clrscr(); cust c;

ifstream f ("customer.dat" , ios::binary); if(!f) { cout<<"\nError..."; return; } f.read((char*)&c , sizeof(c)); while(f) { c.showcust(); f.read((char*)&c, sizeof(c)); } f.close(); clrscr(); }

struct date indate(int &s) //Work With Check-In & Check Out Dates {

int day,mon,year; struct date d, d1;

getdate(&d); // (from dos.h) ,takes current date from system d1=d;

(13)

printf("\nThe current year is: %d\n", d.da_year); printf("\nThe current day is: %d\n", d.da_day); printf("\nThe current month is: %d\n", d.da_mon); int mo[]={31,29,31,30,31,30,31,31,30,31,30,31}; cout<<"\n\n\nEnter Days to Be Add :\t";

cin>>s; day=d.da_day; mon=d.da_mon; year=d.da_year; int s1=int(d.da_day)+s; do{

if(d.da_mon==2 && d.da_year%4==0) { if(s1>29) { d.da_mon++; s1-=29; }} else

if(d.da_mon==2 && d.da_year%4!=0) { if(s1>28) { d.da_mon++; s1-=28; } } switch(d.da_mon) { case 4: case 6: case 9: case 11: if(s1>30) { d.da_mon++; s1-=30; } break; case 1: case 3: case 5:

(14)

case 7: case 8: case 10: if(s1>31) { d.da_mon++; s1-=31; } break; case 12: if(s1>31) { d.da_mon=1; d.da_year ++; s1-=31; } } }while(mo[d.da_mon-1]<s1); d.da_day=s1;

printf("\nThe checkout year is: %d\n", d.da_year); printf("\nThe checkout day is: %d\n", d.da_day); printf("\nThe checkout month is: %d\n", d.da_mon); getch();

return d; }

///////////////////////////////////////////////////////////////////////////// //To main Menu(Main Screen)

(15)

{ int i; textcolor(YELLOW); clrscr(); gotoxy(35,12); cout<<"LOADING DATA !"; } void bar() { int i,x=22,x1=22; for(i=0;i<40;i++) { gotoxy(x,18); cout<<"°"; x++; } textcolor(DARKGRAY); for(i=0;i<40;i++) { gotoxy(x1,18); cprintf("°"); x1++; delay(100); } } void menu() { clrscr(); textcolor(YELLOW); gotoxy(33,10); cprintf("LOADING MENU"); for(int n=0;n<5;n++) { delay(1000); cprintf("."); } clrscr(); textcolor(LIGHTGREEN); int y1=4,y=4,i;

(16)

clrscr(); gotoxy(25,4); for(i=0;i<15;i++) cout<<"**"; for(i=0;i<19;i++) { gotoxy(25,y1); cout<<"**"; y1++; } gotoxy(25,23); for(i=0;i<15;i++) cout<<"**"; for(i=0;i<19;i++) { gotoxy(53,y); cout<<"**\n"; y++; } textcolor(LIGHTCYAN); gotoxy(38,5); cprintf("MENU"); } void mainmenu() { clrscr(); int c=0,i,j; while (c<=5) { textcolor(LIGHTCYAN); gotoxy(38,5); cprintf("MENU"); textcolor(WHITE); gotoxy(27,7); cprintf("1.Manage Rooms"); gotoxy(27,9); cprintf("2.Reserve a Room"); gotoxy(27,11); cprintf("3.Leave A Room");

(17)

gotoxy(27,13); cprintf("4.Query"); gotoxy(27,15); cprintf("5.EXIT "); gotoxy(27,17); cin>>c; gotoxy(27,15); cout<<" "; switch(c) { case 1:roommenu(); break; case 2:reserve(); break; case 3:leaveroom(); break; case 4:query(); break; case 5:operate(); break;

default : cout<<"Enter valid choice...:"; break;

} } }

//end of Main Screen

//////////////////////////////////////////////////////////////////////////////////// void roommenu() { int c; clrscr(); menu(); textcolor(WHITE); gotoxy(27,7); cprintf("1.Add Room"); gotoxy(27,8); cprintf("2.Modify Room");

(18)

gotoxy(27,9);

cprintf("3.Delete A Room"); gotoxy(27,10);

cprintf("4.Show all Rooms"); gotoxy(27,11);

cprintf("5.Go Back To Main Menu "); cin>>c; switch(c) { case 1:insertroom(); break; case 2:updateroom(); break; case 3:delroom(); break; case 4:show_all_room(); break; case 5:{ clrscr(); mainmenu(); } break; } }

//functions inside room menu

//////////////////////////////////////////////////////////////////////////

void insertroom() //To Write in the Room file { clrscr(); int x; room r; ifstream f("ROOM.dat",ios::binary); if(!f) {

(19)

r.rno=100; } f.read((char*)&r , sizeof(r)); while(f) { f.read((char*)&r , sizeof(r)); } r.rno+=1; r.addroom(); f.close();

ofstream f1("ROOM.dat" , ios::binary | ios::app); if(!f1) { cout<<"Error....!!"; clrscr(); } f1.write((char*)&r,sizeof(r)); f1.close(); clrscr(); getch(); }

void delroom() //delete room { clrscr(); int rono; room r; ifstream f3("ROOM.dat",ios::binary); ofstream f4("Temp.dat",ios::binary); if(!f3||!f4) { cout<<"\nFile Error...!!!"; return; } int flag=0; char ch;

cout<<"\nEnter the Room No. to be Deleted:\t"; cin>>rono;

f3.read((char*)&r , sizeof(r)); while(f3)

(20)

if(rono!=r.rno || r.retstatus()==1) f4.write((char*)&r , sizeof(r)); else

{

r.showroom();

cout<<"\n\nDo You Really Want To Delete ?(Y/N)\t"; cin>>ch; if(ch=='y'||ch=='Y') flag=1; else { flag=2; f4.write((char*)&r,sizeof(r)); } } f3.read((char*)&r , sizeof(r)); } f4.close(); f3.close(); remove("ROOM.dat"); rename("Temp.dat" , "Room.dat"); if(flag==0)

cout<<"\n\nRoom number Cannot Be Deleted!!!" ; else

if(flag==1)

cout<<"\n\nRoom number "<<rono<<" deleted !!!\n\n"; else

cout<<"\n\nDeletion Suspended\n\n"; getch();

clrscr(); }

void updateroom() //update the room {

(21)

clrscr(); int rono; room r; fstream f2("ROOM.dat",ios::binary|ios::in|ios::out); if(!f2) { cout<<"\nError..."; return; }

cout<<"\n\nEnter the Room No. Whose Details Are to be Modified :\t"; cin>>rono;

f2.read((char*)&r , sizeof(r)); while(f2)

{

if(rono==r.rno && r.retstatus()==0) { r.modify(); f2.seekg(f2.tellg()-sizeof(r)); f2.write((char*)&r,sizeof(r)); break; } f2.read((char*)&r , sizeof(r)); } if(f2.eof())

cout<<"\n\nRoom No. either Not Present or Already Reserved !"; f2.close(); clrscr(); } void show_all_room() { clrscr(); int c=0; room r; ifstream f3("ROOM.dat",ios::binary); if(!f3)

(22)

{ cout<<"\nFile Error...!!!"; return; } f3.read((char*)&r , sizeof(r)); while(f3) { c++; r.showroom(); f3.read((char*)&r , sizeof(r)); } f3.close(); if(c==0) {

cout<<"\n\n\t\tNo Room Exists..."; clrscr();

} }

//end of room menu functions

//reserve a room & check-out a room start here.

////////////////////////////////////////////////////////////////////////////////// void reserve()

{

clrscr(); cust c;

ofstream f("customer.dat" , ios::binary); if(!f) { cout<<"\nError !"; return; } c.input(); f.write((char*)&c , sizeof(c)); f.close(); }

(23)

void leaveroom() //To CheckOut Room & change Status & pay Bill {

int rono; cust c; room r;

unsigned long balanc; clrscr(); gotoxy(35,2); cout<<"LEAVE ROOM"; fstream f ("ROOM.dat",ios::binary|ios::in|ios::out) ; ifstream f3("customer.dat",ios::binary); ofstream f4("Temp.dat",ios::binary); if(!f||!f3||!f4) { cout<<"\nFile Error...!!!"; return; } int flag=0; char ch;

cout<<"\nEnter the Room No. : \t"; cin>>rono; f3.read((char*)&c , sizeof(c)); while(f3) { if(rono!=c.room_no ) f4.write((char*)&r , sizeof(r)); else { c.showcust();

cout<<"\n\nDo You Really Want To LEAVE ?(Y/N)\t"; cin>>ch;

if(ch=='y'||ch=='Y') {

flag=1;

cout<<"\n\nTotal Amount :\t"<<" Rs. "<<c.adamt+c.bal; cout<<"\n\nAmount Payed :\t"<<" Rs. "<<c.adamt; cout<<"\n\nBalance left :\t"<<" Rs. "<<c.bal;

(24)

while(balanc!=c.bal) {

cout<<"\n\nPay Balance :\t"<<" Rs. "; cin>>balanc;

}

f.read((char *)&r ,sizeof(r)); while(f) { if(r.rno==rono) r.rstatus=0; f.read((char*)&r , sizeof(r)); }

cout<<"\n\n\tAll Dues Cleared...!"; getch(); } else { flag=2; f4.write((char*)&r,sizeof(r)); } } f3.read((char*)&r , sizeof(r)); } f4.close(); f3.close(); remove("customer.dat"); rename("Temp.dat" , "customer.dat"); if(flag==0)

cout<<"\n\nRoom number "<<rono<<" is not vacant!!!" ; else

if(flag==1)

cout<<"\n\nRoom number "<<rono<<" is vacant now!!!\n\n"; else

cout<<"\n\nLeaving Suspended\n\n"; getch();

(25)

clrscr(); }

/////////////////////////////////////////////////////////////////////////////////// // Query part begins here.

/////////////////////////////////////////////////////////////////////////////////// void query() { querymenu(); querymainmenu(); getch(); } void querymenu() { clrscr(); textcolor(YELLOW); cprintf("LOADING QUERY"); for(int n=0;n<5;n++) { delay(1000); cprintf("."); } clrscr();

(26)

highvideo(); textcolor(LIGHTCYAN); gotoxy(38,5); cprintf("QUERY"); } void querymainmenu() { int c=0,i,j; while (c<=6) { textcolor(WHITE); gotoxy(27,7); cprintf("1.Search a Room"); gotoxy(27,8); cprintf("2.Search a Customer"); gotoxy(27,9);

cprintf("3.Number Of Occupied Rooms"); gotoxy(27,10);

cprintf("4.Number of Unoccupied Rooms"); gotoxy(27,11);

cprintf("5.Number Of Free Rooms of Specific Type"); gotoxy(27,12); cprintf("6.Main Menu"); gotoxy(27,14); cin>>c; gotoxy(27,14); cout<<" "; switch(c) { case 1:searchroom(); break; case 2:searchcust(); break;

case 3:noocc(); //no. of occupied rooms break;

case 4:nounocc(); //no. of unoccupied rooms break;

case 5:nofrs(); //no. of free rooms of specific type break;

(27)

case 6:{ clrscr(); mainmenu(); } break; } } getch(); }

void nofrs() //no. of free rooms of specific type {

clrscr(); room r;

int snac=0,dnac=0,sac=0,dac=0,lux=0; //single non ac,double non ac,single ac,double ac,luxury ifstream f("ROOM.dat",ios::binary); if(!f) { cout<<"\n\tERROR..."; return; }

f.read((char*) &r , sizeof(r)); while(f) { if(r.rstatus==0) { if(strcmpi(r.retroomtype(),"Single AC")==0) sac++; else if(strcmpi(r.retroomtype(),"Single NonAC")==0) snac++; else if(strcmpi(r.retroomtype(),"Double AC")==0) dac++; else if(strcmpi(r.retroomtype(),"Double NonAC")==0) dnac++;

(28)

else

if(strcmpi(r.retroomtype(),"LUXURY")==0) lux++;

}

f.read((char*) &r , sizeof(r)); }

if(sac==0 && snac==0 && dac==0 && dnac==0 && lux==0) cout<<"\n\n\tNo room Is free..All rooms are occupied...";

else {

cout<<"\n\tSingle AC : "<<sac;

cout<<"\n\n\tSingle Non AC : "<<snac; cout<<"\n\n\tDouble AC : "<<dac; cout<<"\n\n\tDouble Non AC : "<<dnac; cout<<"\n\n\tLUXURY : "<<lux; } f.close(); getch(); clrscr(); mainmenu(); }

void noocc() //no. of occupied rooms {

(29)

room r; int c=0; ifstream f("ROOM.dat",ios::binary); if(!f) { cout<<"\n\tERROR..."; return; }

f.read((char*) &r , sizeof(r)); while(f)

{

if(r.rstatus==1) c++;

f.read((char*) &r , sizeof(r)); }

if(c==0)

cout<<"\n\n\tNo room Is Occupied..All rooms are free..."; f.close();

getch(); clrscr(); mainmenu(); }

void nounocc() //no. of unoccuipied rooms { clrscr(); room r; int c=0; ifstream f("ROOM.dat",ios::binary); if(!f) { cout<<"\n\tERROR..."; return; }

(30)

while(f) { if(r.rstatus==0) { c++; r.showroom(); }

f.read((char*) &r , sizeof(r)); }

if(c==0)

cout<<"\n\n\tNo room Is free..All rooms are occupied..."; f.close();

getch(); clrscr(); mainmenu(); }

void searchroom() //search a room no. {

clrscr(); int srno;

cout<<"\nEnter the room no. You want to search:\t"; cin>>srno;

room r; cust c;

ifstream f("ROOM.dat" , ios::binary); ifstream f1("customer.dat", ios::binary); if(!f||!f1) { cout<<"\nError"; return; } f.read((char*)&r , sizeof(r)); f1.read((char*)&c , sizeof(c)); while(f) {

if(srno==r.rno && srno==c.retcustroom_no()) {c.showcust();

(31)

} else if(srno==r.rno) { r.showroom(); break; } f.read((char*)&r , sizeof(r)); f1.read((char*)&c , sizeof(c)); } if(f.eof())

cout<<"\nNot Found... Make Sure that You"<<"\nHave Entered Correct Room No.!"; f.close();

getch(); clrscr(); mainmenu(); }

void searchcust() //search a customer name {

clrscr();

char name[50];

cout<<"\nEnter the Customer Name to search:\t"; gets(name);

cust c;

ifstream f("Customer.dat" , ios::binary); if(!f) { cout<<"\nError"; return; } f.read((char*)&c , sizeof(c)); while(f) { if(strcmpi(name,c.retcname())==0) { c.showcust(); break; } f.read((char*)&c , sizeof(c)); } if(f.eof())

(32)

{

cout<<"\nNot Found... Make Sure that You"<<"\nHave Entered Correct Customer Name!"; getch(); clrscr(); } f.close(); getch(); clrscr(); mainmenu(); }

//end of Query part

/////////////////////////////////////////////////////////////////////////// //For Terminating Program !

/////////////////////////////////////////////////////////////////////////// void border() { _setcursortype(_NOCURSOR); int i,y=13,y1=13,a=179,b=196,c=218,d=192,e=217,f=191,l=176; for(i=0;i<5;i++) { gotoxy(25,y); cout<<char(a); y++; } gotoxy(26,12); for(i=0;i<30;i++) cout<<char(b); gotoxy(26,18); for(i=0;i<30;i++) cout<<char(b); for(i=0;i<5;i++)

(33)

{ gotoxy(56,y1); cout<<char(a); y1++; } gotoxy(56,12); cout<<char(f); gotoxy(25,12); cout<<char(c); gotoxy(25,18); cout<<char(d); gotoxy(56,18); cout<<char(e); gotoxy(57,11); cout<<char(f); gotoxy(24,11); cout<<char(c); gotoxy(24,19); cout<<char(d); gotoxy(57,19); cout<<char(e); _setcursortype(_NORMALCURSOR); } void back() { _setcursortype(_NOCURSOR); gotoxy(29,13); cout<<"S"; delay(180);

(34)

cout<<"o"; delay(180); cout<< "ft"; delay(180); cout<<"wa"; delay(180); cout<<"re "; delay(700); cout<<"Ter"; delay(180); cout<<"mi"; delay(180); cout<<"na"; delay(180); cout<<"ti"; delay(180); cout<<"ng"; delay(180); cout<<"..."; gotoxy(1,24); cout<<"TH"; delay(180); cout<<"AN"; delay(180); cout<<"K "; delay(180); cout<<"YOU !"; delay(180); cout<<" FOR"; delay(700); cout<<" USI"; delay(180); cout<<"NG"; delay(180); cout<<" OUR"; delay(180); cout<<" SOF"; delay(180); cout<<"TWARE !"; delay(500);

(35)

gotoxy(1,24); for(int i=0;i<80;i++) cout<<" "; gotoxy(1,24); cout<<"GO"; delay(180); cout<<"OD"; delay(180); cout<< " BY"; delay(180); cout<<"E"; delay(180); cout<<".."; delay(180); cout<<"..!"; _setcursortype(_NORMALCURSOR); } void load() { _setcursortype(_NOCURSOR); int i,x,j,a; gotoxy(28,16); for(i=0;i<26;i++) { textcolor(YELLOW); cprintf("°"); } gotoxy(28,16); for(i=0;i<26;i++) { textcolor(LIGHTGREEN); cprintf("°"); delay(200); } _setcursortype(_NORMALCURSOR); }

(36)

void makers() { int i,a,b,c,d; textcolor(YELLOW); gotoxy(1,1) ; for(i=0;i<80;i++) { cprintf("*"); delay(80); } gotoxy(1,6); for(i=0;i<80;i++) { cprintf("*"); delay(80); } gotoxy(20,3); textcolor(LIGHTMAGENTA);

cprintf("A PROGRAM BY ASHWANI KUMAR & NITESH SALUJA"); } void operate() { clrscr(); border(); makers(); back(); load(); delay(1000); exit(0); }

(37)

//////////////////////////////////////////////////////////////////////////

//confirm username & password ! HERE.

void border1() { _setcursortype(_NOCURSOR); int i,y=8,y1=8,a=179,b=196,c=218,d=192,e=217,f=191,l=176; for(i=0;i<5;i++) { gotoxy(25,y); cout<<char(a); y++; } gotoxy(26,7); for(i=0;i<30;i++) cout<<char(b); gotoxy(26,13); for(i=0;i<30;i++) cout<<char(b); for(i=0;i<5;i++) { gotoxy(56,y1); cout<<char(a); y1++; } gotoxy(56,7);

(38)

cout<<char(f); gotoxy(25,7); cout<<char(c); gotoxy(25,13); cout<<char(d); gotoxy(56,13); cout<<char(e); gotoxy(57,6); cout<<char(f); gotoxy(24,6); cout<<char(c); gotoxy(24,14); cout<<char(d); gotoxy(57,14); cout<<char(e); _setcursortype(_NORMALCURSOR); } void con() { int c=1,f=1,i,t; char unm[20],c1,p1[50]; gotoxy(1,1);

cout<<"\n\t\tWELCOME USER ! PLEASE INPUT CORRECT DETAILS HERE."<<"\n\tIF YOU ENTER WRONG DETAILS THRICE, APPLICATION WILL TERMINATE !!" ;

(39)

{ border1(); gotoxy(30,8); cout<<"Username: "; gets(unm); gotoxy(30,9); cout<<"Password: "; i=0; c1='\0'; _setcursortype(_NORMALCURSOR); c1=getch(); while(c1!='\r') { if (c1=='\b'&& i!=0) { cout<<"\b \b"; i--; } else if(c1!='\b') { cout<<"*"; p1[i++]=c1; } c1=getch(); } p1[i]='\0'; gotoxy(24,17);

cout<<"Please Press Any Key To Continue.."; getch();

clrscr();

_setcursortype(_NOCURSOR ); gotoxy(28,9);

cprintf("Checking The Data"); delay(1500);

cout<<"\a\a\a\a\a\a\a\a\a."; delay(1500);

(40)

cout<<"\a\a\a\a\a\a\a\a\a."; delay(1500); cout<<"\a\a\a\a\a\a\a\a\a."; delay(1500); cout<<"\a\a\a\a\a\a\a\a\a."; delay(1500);

if( (strcmp(unm,"admin")==0) && (strcmp(p1,"12345")==0) ) {

f=0; //correct username & password clrscr();

gotoxy(28,12);

cout<<"Correct Data Entered !" ; break;

}

if( (strcmp(unm,"admin")!=0) || (strcmp(p1,"12345")!=0) ) {

f=1; //incorrect username or password c++;

clrscr();

gotoxy(24,12);

cout<<"\a\a"<<"Invalid Username Or Password !!"; delay(2030); clrscr(); gotoxy(35,2); cout<<"\a\aAttempt - "<<c; } _setcursortype( _NORMALCURSOR ); } if(c>3) { clrscr(); gotoxy(31,11);

cout<<"\a\aNO CORRECT DATA FOUND !"; gotoxy(24,13);

cout<<"Now,Application is terminating..."; delay(800);

operate(); //function to abort the program }

(41)

} void login() { clrscr(); con(); getch(); } void ash_nit() { textcolor(YELLOW); gotoxy(1,24); cprintf("CREATED"); delay(1000); cprintf(" BY:"); delay(1000); cprintf(" NITESH"); delay(1000); cprintf(" &"); delay(1000); cprintf(" ASHWANI"); delay(1200); }

void ice() //for first loading part {

_setcursortype(_NOCURSOR); int i;

textcolor(LIGHTMAGENTA); clrscr();

cout<<"\n\n\n\n\t\t WELCOME TO HOTEL ROOM RESERVATION SYSTEM"; cout<<"\n\n\n\n\t\t\t\tLOADING...";

(42)

{ cout<<i<<"%"; delay(68); gotoxy(43,9); } cout<<"\n\n\n\n"; textcolor(LIGHTRED); for(i=0;i<80;i++) { cprintf("#"); delay(40); } gotoxy(1,3); { for(i=0;i<80;i++) { cprintf("#"); delay(40); } } gotoxy(1,4); { for(i=0;i<9;i++) { cprintf("#"); cout<<endl; delay(40); } } int p=80,q=4; for(i=0;i<9;i++) { gotoxy(p,q); cprintf("#\n"); delay(40);

(43)

q++; } ash_nit(); cout<<"\n\n\n"; for(int n=0;n<14;n++) { textcolor(LIGHTCYAN); for(i=0;i<3;i++) { gotoxy(35,20); cprintf(". "); delay(90); gotoxy(37,20); cprintf(". "); delay(90); gotoxy(39,20); cprintf(". "); delay(90); gotoxy(41,20); cprintf(". "); delay(90); gotoxy(43,20); cprintf(". "); delay(90); gotoxy(45,20); cprintf(". "); delay(90); } textcolor(WHITE); if(n>0 && n<6) { gotoxy(33,17); cprintf("Initialising..."); } if(n>6 && n<12) { gotoxy(33,17); cprintf("Checking Files..."); }

(44)

if(n>12) { gotoxy(33,17); cprintf("Please Wait ..."); delay(200); } textcolor(LIGHTCYAN); gotoxy(35,20); cout<<"*"; delay(90); gotoxy(37,20); cout<<"*"; delay(90); gotoxy(39,20); cout<<"*"; delay(90); gotoxy(41,20); cout<<"*"; delay(90); gotoxy(43,20); cout<<"*"; delay(90); gotoxy(45,20); cout<<"*"; delay(90); } _setcursortype(_NORMALCURSOR);

} //Initialise,Check gets finished HERE.

void loading() {

clrscr(); ice();

gotoxy(28,23);

cout<<"Press any Key To Continue..!"; getch();

clrscr(); }

(45)

//first screen to display 'an' void f5() { textcolor(LIGHTGRAY); for(int j=0;j<2000;j++) { cprintf("*"); delay(5); } } void f6() { int i,j,k=10,y=6,p=3 ,q=31 ; textcolor(YELLOW); gotoxy(19,6); for(i=0;i<13;i++) { delay(100); cprintf("@"); } for(i=0;i<8;i++) { delay(100); gotoxy(31,y); cprintf("@"); y++; } for(i=0;i<11;i++) { delay(100);

(46)

gotoxy(q,10); cprintf("@"); q--; } for(i=0;i<4;i++) { delay(100); gotoxy(20,k); cprintf("@"); k++; } gotoxy(20,14); for(i=0;i<22;i++) { delay(100); cprintf("@"); } } void f7() { int i,x,y=14,p=42,q=6,r=20; for(i=0;i<8;i++) { delay(100); gotoxy(42,y); cprintf("@"); y--; } for(i=0;i<14;i++) { delay(100); gotoxy(p,q); cprintf("@"); p++; q++; }

(47)

for(i=0;i<20;i++) { delay(100); gotoxy(56,r); cprintf("@"); r--; } for(i=0;i<7;i++) { delay(100); cprintf("@"); } } void creater() { textcolor(YELLOW); gotoxy(24,22); cprintf("A Ashwani"); delay(200); cprintf(" & "); delay(500); cprintf("Nitesh"); delay(250); cprintf(" Application !"); } void symbol() { _setcursortype(_NOCURSOR); clrscr(); f5(); f6(); f7(); creater(); _setcursortype(_NORMALCURSOR); cout<<"\a\a\a\a"; delay(1000); textcolor(YELLOW); gotoxy(24,24);

(48)

getch(); clrscr(); }

///////////////////////////////////////////////////////////////////////// // main() begins here.

void main() { clrscr(); window(1,1,80,50); textbackground(LIGHTRED); symbol(); loading(); login(); fun(); bar(); menu();

mainmenu(); // main screen/main menu called here. getch();

}

References

Related documents

[r]

ó9ê¶Ø/ô9Õ~Ú;çuցè9ÚÕAÙ%Ú;ïˆ×¼ê£ð~Ù%Øué¼Ø7ÕÇÖwêŸÚ åaååaååaååaåHååaåHååHåaååaååaååaåaå õ ä/å¬ò9å~ä

[r]

[r]

Ö %HÑ Ø ÓUÓ1ÜåÖlðÒç1ÖÝ1ÝLÜ éçoæ ç!ÑÓ1Ô Ó1éÐÖRÓ1ܹԂälÑ ç!ÐÜsî·éçfÑ ØóÑ

[r]

Blazing New Paths From Ancient Footprints: Enactment Of Mexican Traditional Dance And Music folklórico In A New York Urban Community Of Early Childhood Learners Pamela Proscia

ABCDEFGHIBJIEKDBCFHIBJEDLDGCMJCNDJFOKPKCQJIRJFJGISTFBQJCIJKBCDEFGCJUKCNJCNDJKBVKWKVXFPJ