hi!!
i have written this program and it worked, but the problem is ,when it runs it requires username and password. i've no idea about that. plzzz help,i wants to submit immediately.thanks. the code is given below:
ismailmhd 0 Newbie Poster
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
#include <fstream.h>
#include <conio.h>
#include <string.h>
#include <stdio.h>
void timedelay1();
void heading();
void timedelay();
void main()
{
struct psgr
{
char passname[20];
};
struct seatclass
{
char sclass[20];
};
struct triptype1
{
char ttype[20];
};
struct flightname
{
char fname[20];
};
struct flighttime
{
char ftime[10];
};
struct ticket
{
long resnum;
int pnum;
char agname[20],triptypee[7],cclass[10],destination[10];
};
int gi,i,k,zl,triptype,passnum,class1,flightselret,pi,qi,depdate,arrivaldate;
int quitnum,destlen,X1,X2,agentchoice,flag,beg,back,ppi,keypass,totalamount,aglen,sizee;
int v,v2,v3,v4,v5,v6,v7,v28,v29,v30,totalfare,totaltax,selection=0,dselection=0,fselection=0;
char dest[15],text[10];
char name1[15],name2[15],name3[15],name4[15],name5[15],agentname[20],password;
long renum;
int k1,k2,k3,totalfare1,v9,v10,v11,v15,v16,v17,v18,v19,creditnum,v21,v22,v25;
ticket ft;
psgr passlist[6];
seatclass cc[4]={"Economy","Business","First"};
triptype1 tt[3]={"single","return"};
textcolor(YELLOW);
clrscr();
timedelay1();
timedelay1();
for(i=0;i<=22;i++)
cout<<"\n";
cout<<"\t\tWELCOME TO NIMS AIRLINES RESERVATION SYSTEM.VERSION 2.O"<<endl;
cout<<"\t\t (c) Ismail n Safeer Tehnologies Inc.2010-2011";
timedelay();
timedelay1();
heading();
textcolor(RED);
gotoxy(32,5);
cprintf("\n\n\n W A R N I N G!");
textcolor(YELLOW);
cout<<"\n\n\n\t\t ONLY AUTHORISED USERS PERMITTED";
cout<<"\n\n\n\t\t Due to Security Reasons ,Program will Shut Down";
cout<<"\n\n\t\t Automatically If Wrong Password Is Entered Thrice";
cout<<"\n\n\n\t\t PROTECTED BY:THECKEY LABS U S A.";
cout<<"\n\n\n\t\t Press Any Key To Continue....";
getch();
heading();
timedelay();
keypass=1;
textcolor(RED);
gotoxy(32,5);
cprintf("\n\n L O G I N P A G E");
textcolor(YELLOW);
timedelay();
cout<<"\n\n\n\n\t PLEASE ENTER YOUR USERNAME:";
gets(agentname);
fflush(stdin);
aglen=strlen(agentname);
up7:if(aglen<3)
{
cout<<"\n\t Please Type Again:";
gets(agentname);
fflush(stdin);
aglen=strlen(agentname);
if(aglen<1)
goto up7;
}
cout<<"\n\n";
do
{
cout<<"\n\t PLEASE ENTER YOUR PASSWORD:";
set:cin>>text;
zl=strlen(text);
flag=1;
beg=0;
back=zl-1;
while((beg<=back)&flag)
{
if(text[beg]==text[back])
flag=1;
else flag=0;
beg++;
back--;
}
if((zl<6)||(!flag))
{
keypass++;
if(keypass>3)
{
timedelay();
cout<<"\n\n\t\t\t S O R R Y!";
timedelay();
timedelay();
cout<<" UNAUTHORISED ENTRY DETECTED";
timedelay();
cout<<"\n\n\t\t Press ANY KEY To Close The Program...";
getch();
}
cout<<"\n\t INCORRECT PASSWORD PLEASE TYPE AGAIN:";
goto set;
};
}
while (!flag);
if(flag)
cout<<"\n\n\t SUCCESSFUL!! YOU CAN PROCEED WITH THE PROGRAM...";
getch();
HOME:heading();
timedelay();
textcolor(RED);
gotoxy(40,8);
cprintf("H O M E");
timedelay();
textcolor(YELLOW);
cout<<"\n\n\n\t WELCOME";
cout<<agentname<<",";
timedelay();
cout<<"\n\n\n\t WHAT WOULD YOU LIKE TO DO?";
cout<<"\n\n\n\t 1.BOOK A TICKEt";
cout<<"\n\n\t 2.VIEW ALL THE BOOKINGS";
cout<<"\n\n\t 3.LOGOUT";
cout<<"\n\n\n\t YOUR CHOICE:";
up2:cin>>agentchoice;
if((agentchoice>3)||(agentchoice<1))
{
cout<<"\n\t INCORRECT CHOICE, Please Choose Again:";
goto up2;
}
if(agentchoice==3)
if(agentchoice==2)
{
RECO:heading();
timedelay();
textcolor(RED);
gotoxy(36,8);
cprintf("R E C O R D S");
textcolor(YELLOW);
getch();
cout<<"\n";
ifstream ifile;
ifile.open("nimsair.dat",ios::in);
if(!ifile)
{
cout<<"\n\n\t\t Sorry ,No Records Entered Yet";
getch();
}
if(ifile)
{
ifile.read((char*)&ft,sizee);
while(!ifile.eof())
{
cout<<"\n\t\t\t"<<"AGENT NAME :"<<ft.agname;
cout<<"\n\t\t\t"<<"RESERVATION NUMBER :"<<ft.resnum;
cout<<"\n\n\t\t\t"<<"STATUS : CONFIRMED";
cout<<"\n\n\t\t\t"<<"NO.OF PASSENGERS :"<<ft.pnum;;
cout<<"\n\t\t\t"<<"TRIP TYPE :";
puts(ft.triptypee);
fflush(stdout);
cout<<"\t\t\t"<<" CLASS :";
puts(ft.cclass);
fflush(stdout);
cout<<"\t\t\t"<< "DESTINATION : ";
puts(ft.destination);
fflush(stdout);
cout<<"\n\t\t\t";
textcolor(RED);
cprintf("========================================");
cout<<"\n";
timedelay();
textcolor(YELLOW);
getch();
ifile.read((char*)&ft,sizee);
}
ifile.close();
}
getch();
if(fselection==1)
goto HOME;
};
book:heading();
timedelay();
selection=0;
cout<<"\n\n\n\t PLEASE SELECT THE TRI DETAILS:";
timedelay();
cout<<"\n\n\n\t Pls Select The Type Of Trip";
cout<<"\n\n\t 1.Single Trip";
cout<<"\n\t 2.Round Trip\n\n\tChoice:";
cin>>triptype;
up3:if((triptype>2)||(triptype<1))
{
cout<<"\n\t INCORRECT CHOICE,Please Choose Again:";
cin>>triptype;
if((triptype>2)||(triptype<1))
goto up3;
}
cout<<"\n\n\t Pls Enter The Number Of Passengers:";
cin>>passnum;
cout<<"\n\n\t Pls Type Your Destination:";
gets(dest);
fflush(stdin);
destlen=strlen(dest);
up6:if(destlen<3)
{
cout<<"\n\\t INCORRECT CHOICE, Please Choose Again:";
gets(dest);
fflush(stdin);
destlen=strlen(dest);
if(destlen<3)
goto up6;
}
cout<<"\n\n\t Pls Enter The Dparture Date (ddmm)";
cout<<"\n\t (Eg.1205,0615)\n\n\tDate:";
cin>>depdate;
if(triptype==2)
{
cout<<"\n\n\t Pls Enter The Return Date (ddmm):";
cin>>arrivaldate;
}
clrscr(); //.............For Search screen
heading();
cout<<"\n\n\n\t SEARCHING FOR REQUEST";
cout<<"\n\n\t PLEASE WAIT....\n\n\t";
timedelay();
for(k1=0;k1<=10;k1++)
cout<<"*";
timedelay();
for(k2=0;k2<=39;k2++)
cout<<"*";
timedelay();
for(k3=0;k3<=12;k3++)
cout<<"*";
timedelay();
clrscr(); //...................For Flight Viewer
heading();
timedelay();
cout<<"\n\n\n\t SEARCH SUCCESSFUL!!!";
timedelay1();
cout<<" \n\n\t THE REQUIRED SEATS ARE AVAILABLE IN THE FOLLOWING FLIGHTS:";
timedelay();
cout<<"\n\n\n\t 1.NIMS AIR 2.NIMS 3.NIMS AIR";
cout<<"\n\t FI-1745 FI-0645 FI-0289";
cout<<" 22:00pm 17:20pm :15:45pm";
timedelay();
cout<<"\n\n\n\t 4.NIMS AIR 5.NIMNS AIR 6.NIMS AIR";
cout<<"\n\t FI-0067 FI-0917 FI-6117";
cout<<"\n\t 13:10pm 18:00pm 12:00pm";
timedelay();
char flightsel;
cout<<"\n\n\n\t Please Choose Your Flight:";
cin>>flightsel;
df:if((flightsel>6)||(flightsel<1))
{
cout<<"\n\t INCORRECT CHOICE.Please Choose Your Flight Again:";
cin>>flightsel;
if((flightsel>6)||(flightsel<1))
goto df;
}
if(triptype==2) //.............For Return Flight Selection
{
heading();
timedelay();
cout<<"\n\n\t THE SEATS(S) FOR THE RETURN TRIP ARE AVAILABLE IN THE FOLLOWING FLIGHTS:";
timedelay();
cout<<"\n\n\n\t 1.NIM AIR 2.NIMS AIR 3.NIMS AIR";
cout<<"\n\t FI-0067 FI-0917 FI-6117";
cout<<"\n\t 13:10pm 18:00pm 12:00pm";
timedelay();
cout<<"\n\n\n\t 4.NIMS AIR 5.NIMS AIR 6.NIMS AIR";
cout<<"\n\t FI-1745 FI-0645 FI-0289";
cout<<"\n\t 22:00PM 17:20pm 15:45pm";
timedelay();
cout<<"\n\n\n\t Please Choose Your Return Flight:";
cin>>flightselret;
dff:if((flightselret>6)||(flightselret<1))
{
cout<<"\n\t INCORRECT CHOICE,Please Choose Your Flight Again:";
cin>>flightselret;
if((flightselret>6)||(flightselret<1))
goto dff;
}
} //..................END of Return Flight Selection
heading();
timedelay();
cout<<"\n\t THE FOLLOWING ARE THE TICKET CHARGE FOR THE SELECTED TRIP:\n\n";
cout<<"\t"; //...................Begin class page
for(v9=0;v9<=58;v9++)
cout<<"-";
cout<<" TICKET CHARGES (IN AED)\\n\t";
for(v10=0;v10<=58;v10++)
cout<<"-";
timedelay();
cout<<"\n\n\t CLASS \t\t\t\t SINGLE \t RETURN";
cout<<"\n\n\t 1.Economy\t\t\t\t 1100\t1900";
cout<<"\n\n\t 2.Business\t\t\t\t 2100\t2900";
cout<<"\n\n\t 3.First\t\t\t\t3100\t3900";
for(v11=0;v11<=58;v11++)
cout<<"-";
cout<<"\n\n\n\t Pls Choose Your Required Class:";
cin>>class1;
up:if((class1>3)||(class1<1))
{
cout<<"\n\t INCORRECT CHOICE,Pls Choose Your Class Again:";
cin>>class1;
if((class1>3)||(class1<1))
goto up;
}
heading(); //...............Begin class page2
timedelay();
cout<<"\n\n\n\t";
for(v18-0;v18<=58;v18++)
cout<<"-";
cout<<"\n\t PAYMENT DETAILS\n\t"; //............payment details
for(v19=0;v19<=58;v19++)
cout<<"-";
timedelay();
if(triptype==1)
totalfare1=1100;
else
totalfare=1900;
switch(class1)
{
case2:totalfare1+=1000;break;
case3:totalfare1+=2000;break;
}
if(triptype==1)
{
cout<<"\n\n\t The Fare Per Person For\n\t";
switch(class1)
{
case 1: cout<<" An Economy Class Seat In This Flight = AED"<<totalfare1;break;
case 2: cout<<" A Business Class Seat In This Flight =AED"<<totalfare1;break;
case 3: cout<<" A First Class Seat In This Flight =AED"<<totalfare1;break;
}
cout<<"\n\n\t Ttoal Tax And Surcharges per Person\t =AED 210";
}
else
{
cout<<"\n\n\t The Fare Per Person For";
switch(class1)
{
case1: cout<<" An Economy Class \n\t";
cout<<" Return Trip In This Flight\t\t =AED"<<totalfare1;
break;
case 2: cout<<" A Bussiness Class\n\t";
cout<<" Return Trip In This Flight\t";
cout<<" =AED"<<totalfare1;break;
case 3: cout<<" A First Class \n\t";
cout<<" Return Trip In This Flight\t\t =AED"<<totalfare1;
break;
}
cout<<"\n\n\t Total Tax And Surcharges per Persons\t =AED 210";
}
if(triptype==1)
{
totalfare=passnum*1100;
}
else
{
totalfare=passnum*1900;
}
if(class1==2)
{
totalfare+=(passnum*1000);
}
if(class1==3)
{
totalfare+=(passnum*2000);
}
totaltax=passnum*210;
cout<<"\n\n\t Total Airfare\t\t ="<<totalfare<<"AED";
cout<<"\n\t Total Taxes & Surcharge\t\t ="<<totaltax<<"AED";
cout<<"\n\t Total Amount\t\t ="<<totaltax+totalfare<<"AED:\n\n\t"; //.....End Pay Display
timedelay();
for(v28=0;v28<=58;v28++)
cout<<"-";
cout<<"\n\n\t PASSENGER INFORMATION:\n\ta";
for(v29=0;v29<=58;v29++)
cout<<"-";
timedelay();
cout<<"\n\n\t Please Enter The Names Of The passengers:"; //........Names Of The Passengers
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
If you wrote the program then why don't you know about the username and password?
frogboy77 commented: valid question +1
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.