Airline Reservation System Project In C Language



#include
#include
#include

main()
{
FILE*fp,*ft;
char another,choice;
char name[20];
int tmp,x,fr,amt;

struct bnk
{
char name [20];
char add[20],dob[20],date[20];
int fcode,cl,fare;
int acno,c,fno,st,amt;
float ob,tk;
};
struct bnk e;
struct flt
{
char fname[20];
int fno,tk;
};
struct flt f;
long int recsize,recsize1;

fp=fopen("bnk.DAT","rb+");
if(fp==NULL)
{
fp=fopen("bnk.DAT","wb+");
exit();
}

recsize=sizeof(e);
recsize1=sizeof(f);
while(1)
{
int gd=DETECT,gm,maxx,maxy,x,y,button;
initgraph(&gd,&gm,"i:\tc\bin");
setbkcolor(1);
clrscr();
settextstyle(4,0,6);
outtextxy(200,1," Airline Reservation System ");
outtextxy(200,1," By IGCT Computers");
line(600,10,400,10);

printf("\n\n 1.New Customer");
printf("\n 2.List records");
printf("\n 3.New Flight ");
printf("\n 4.View Flight");
printf("\n 5.Delete records");
printf("\n 0.Exit");
printf("\n\n PLEASE ENTER YOUR CHOICE...\n ");
fflush (stdin);
choice=getche();
switch(choice)
{
case '1':
fseek(fp,0,SEEK_END);
another='y';
while(another=='y')
{
printf("\n Enter Customer Name...\n \t");
scanf("%s",&e.name);
printf("\n Enter Address...\n");
scanf("%s",&e.add);
printf("\n Enter DOB...\n");
scanf("%s",&e.dob);
printf("\nEnter Flight Code...\n");
scanf("%d",&e.fcode);
printf("\nEnter Date..\n");
scanf("%s",&e.date);
printf("\n Enter Class..\n");
scanf("%d",&e.cl);
printf("\nEnter Fare...\n");
scanf("%d",&fr);
printf("\n Enter Seats to Book..\n");
scanf("%d",&e.st);
if(e.cl==1)
{
e.fare=5000;
}
if(e.cl==2)
{
e.fare=3000;
}
else
{
e.fare=1000;
}
e.amt=e.fare+(e.st*fr)+(e.fare+.10);
printf("\n Total Payble amount with tax is %d",e.amt);
fwrite(&e,recsize,1,fp);
printf("\n Add Another Records(y/n)");
fflush(stdin);
another=getche();
}
break;

case '2':
printf("\nFCode\tName\tAddress\tDOB\tJ-Date\tClass\tSeats\tFare");
printf("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
rewind(fp);
while(fread(&e,recsize,1,fp)==1)
printf("\n%d\t%s\t%s\t%s\t%s\t%d\t%d\t%d",e.fcode,e.name,e.add,e.dob,e.date,e.cl,e.st,e.amt);
getch();
break;


case '3':
fp=fopen("flt.DAT","rb+");
if(fp==NULL)
{
fp=fopen("flt.DAT","wb+");
exit();
}
fseek(fp,0,SEEK_END);
another='y';
while(another=='y')
{
printf("Enter Flight name,FLNO,Fare...\n");
scanf("%s %d %d",&f.fname,&f.fno,&f.tk);
fwrite(&f,recsize1,1,fp);
printf("\n Add Another Records(y/n)");
fflush(stdin);
another=getche();
}
break;

case '4':
printf("\nFlight Code \t FName \t Fare");
printf("\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*");
rewind(fp);
while(fread(&f,recsize1,1,fp)==1)
printf("\n %d \t %s \t %d",f.fno,f.fname,f.tk);
getch();
break;

case '5':
another ='y';
while(another=='y')
{
printf("\n enter name of Person to delete...\n");
scanf("%s",&name);
ft=fopen("pop.DAT","wb");
rewind(fp);
while(fread(&e,recsize,1,fp)==1)
{
if(strcmp(e.name,name)!=0)
fwrite(&e,recsize,1,ft);
}
fclose(fp);
fclose(ft);
remove("bnk.DAT");
rename("pop.DAT","bnk.DAT");
fp=fopen("bnk.DAT","rb+");
printf("delete another record(y/n)");
fflush(stdin);
another=getche();
}
break;

case '0':
fclose(fp);
exit();
}
}
}

Related Links :

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. The problem with buying airline tickets at the airport is that it can be a royal pain to park and wander your way around until you reach the airline you wanted to get the tickets from. en uygun uçak bileti

    ReplyDelete


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!