1. Certificate
2. Acknowledgement
3. System Analysis
4. Header Files
5. Introduction
7. Aim
8. Source code
9. Output
10. Result
11. Bibliography
Name of the
institution................
.............................................
Place...
This is to certify
that
Roll No.Studying
in..
in the year.of
the institute has completed a Practical course
based on C.B.S.E syllabus in
Teacher-in-charge
Principal
Internal Examiner
External Examiner
Acknowledgement
I Owe a great many thanks to a great
many people who helped and
supported me during the editing of
this project.
My deepest thanks to the Computer
science teacher, Mrs. Hema for
guiding and correcting various
documents of mine with attention and
care. She has taken pain to go through
the project and make necessary
corrections as and when needed.
I would also like to thank my
institution and my faculty members
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<process.h>
#include<stdio.h>
#include<conio.h>
void help();
class address
{
protected :
char hno[10],city[30],post[30],colony[30],pin[10];
public :
void address_inp()
{
cout<<" House No. : ";
gets(hno);
cout<<" Colony : ;
gets(colony);
cout<<" Post : ";
gets(post);
cout<<" City : ";gets(city);
cout<<" Pin Code No. : ";gets(pin);
}
void address_out()
{
cout<< hno<<" ,
"<<colony<<" ,"<<post<<",<<city<<,<<pin<<\n
;
}
};
class p_det
{
protected :
address add;
float age;
char name[40];
char sex;
public:
void p_det_inp()
{
cout<<" Enter Name : ";gets(name);
cout<<" Enter address "; add.address_inp();
cout<<" Enter age ;
cin>>age;
cout<<" Enter sex group (M / F) : ;
cin>>sex;
}
void p_det_out()
{
cout<<" PERSONAL DETAILS";
cout<<" Name :;
puts(name);
cout<<" Address : ";
add.address_out();
cout<<" Age (Years.Months) : "<<age;
cout<<" Sex group (M/F) : "<<sex;
}
void assign_name(p_det p,char str[]);
};
void p_det :: assign_name(p_det p,char str[])
{
strcpy(str,p.name);
}
class res
{
char fcode[5],to[15],from[15],via[15];
float fare;
public :
p_det p;
void dest_out()
{cout<<" from : ";
puts(from);
cout<<" to : ";
puts(to) ;
}
void res_inp()
{
res_menu();
cout<<" RESERVATION FORM";
cout<<" ....................................................";
cout<<" Enter flight code : ";gets(fcode);
if( strcmp(fcode,"0871")==0 )
{
strcpy(from,"LUCKNOW");strcpy(to,"DELHI");
fare=100;
}
else if(strcmp(fcode,"0037")==0)
{
strcpy(from,"LUCKNOW");strcpy(to,"CHENNAI");
fare=700;
}
else if(strcmp(fcode,"1070")==0)
{
strcpy(from,"DELHI");strcpy(to,"COCHIN");
fare=730;
}
else if(strcmp(fcode,"1007")==0)
{
strcpy(from,"DELHI");strcpy(to,"BANGALORE");
fare=800;
}
else if(strcmp(fcode,"1017")==0)
{
strcpy(from,"LUCKNOW");strcpy(to,"BANGALORE");
fare=850;
}
else if(strcmp(fcode,"7001")==0 )
{
strcpy(from,"ALLAHBAD");strcpy(to,"DELHI");
fare=80;
}
else
{
cout<<ERROR";
}
p.p_det_inp();
getch();
clrscr();
}
void res_out()
{
cout<<" RESERVATION ENTRIES";
cout<<" ..";
cout<<" Flight Code : ";puts(fcode);
p.p_det_out();
dest_out();
}
void assign_code(res p,char str[]);
};
void assign_code(res p,char str[])
{
strcpy(str,p.fcode);
}
void menu()
{
clrscr();
cout<<"\nMENU";
cout<<"\n 1 . Reservation\n";
cout<<"\n 2 . Querries\n";
cout<< \n3 . Cancellation\n";
cout<<" \n4 . Help";
cout<<" 5 . Exit";
cout<<" Press any key to continue ...";
getch();
}
void res_menu()
{
cout<<"\n;
cout<<" SAHARA AIRLINES ;
cout<<"\n ";
cout<<" \t\t\t\t\t\tRESERVATION / ROUTE / FARE MENU ";
cout<<"\n |SN | FROM | TO |F.CODE| TIMING |DAY |
FARE|;
cout<<"\t\t\t\t\t\t\t | (ARR)|(DEP)|;
cout<<" | 1 | LUCKNOW |DELHI | 0871 | 1530 |1615|
MONDAY|| 100 | ";
cout<<" | 2 | LUCKNOW | CHENNAI | 0037 | 1200 | 1230 |
THURSDAY 700 | ";
cout<<" | 3 | DELHI | COCHIN | 1070| 1740 | 1830 |
FRIDAY |730| ";
cout<<" | 4 | DELHI | BANGALORE| 1007 | 2040 | 2100 |
SUNDAY | 800 | ";
cout<<" | 5| LUCKNOW | BANGALORE| 1017 | 1615 |
1700 |
ifstream fin1
fin.open("oldmas.dat",ios::binary ios::app);
fin.write( (char *) &r,sizeof(r));
fin.close();
fin.open("oldmas.dat",ios::binary ios::in);
fin1.open("newmas.dat",ios::binary ios::out);
fin.read( (char*)&r,sizeof(res) );
while(!fin.eof() )
{
fin1.write( (char*)&r,sizeof(res) );
fin.read( (char*)&r,sizeof(res) );
}
fin.close();
fin1.close();
break;
// C A S E : 2 " S E A R C H I N G"
case 2:
fin.open("newmas.dat",ios::inios::binary);
cout<<_______________________________________________
cout<<" Enter the name : ";gets(name);
cout<<" Enter the flight code : ";gets(code);
while( !fin.eof() )
{
assign_code(r,code1);
r.p.assign_name(r.p,name1);
if(strcmp(name1,name)==0 &&
strcmp(code1,code)==0)
{
clrscr();
cout<<" \n______________________________________________"
;
cout<<\n_______________________________________________
;
cout<<"\n Welcome to `Sahara Querries' ";
cout<<" \n_______________________________________________
";
r.res_out();
rec=1;
cout<<"\n _______________________________________________
________________________;
cout<<"\n_______________________________________________
__;
cout<<" Press any key to continue"; getch();
}
fin.read((char *)&r , sizeof(res));
}
fin.close(); clrscr();
if(rec==0)
{
clrscr();
cout<<" \nRecord not found in Reservation Master";
getch();
}
break;
cout<<\n____________________________________;
// C A S E : 3 " C A N C L A T I O N "
case 3:
cout<<" Enter the Name ";
gets(name);
cout<<" Enter the Flight Code ";
gets(code);
cout<<" Checking for record";
fin.open("oldmas.dat",ios::binary ios::in);
fin1.open("newmas.dat",ios::binary ios::out);
if(fin==NULL && fin1==NULL)
{
cout<<" No records found in Reservation
Master";getch();
goto label;
}
else
{ fin.read( (char*)&r,sizeof(res) );
while(!fin.eof() )
{
assign_code(r,code1);
r.p.assign_name(r.p,name1);// cout<<" name 1 &
code1:;
puts(name1);puts(code1);getch();
if(strcmp(name1,name)==0 &&
strcmp(code1,code)==0)
{
cout<<" Record found!!!!! ";
cout<<" Deleting.";
}
else
{
fin1.write( (char*)&r ,sizeof(res));
}
fin.read( (char*)&r,sizeof(res) );
}
}
fin.close();fin1.close();
cout<<" Record marked for deletion";
getch();
unlink("oldmas.dat");
fin.open("oldmas.dat",ios::appios::binary );
fin1.open("newmas.dat",ios::binary ios::in);
if(fin1==NULL)exit(0);
else
{
fin1.read( (char*)&r,sizeof(res) );
while(!fin1.eof() )
{
fin.write( (char*)&r,sizeof(res) );
fin1.read( (char*)&r,sizeof(res) );
}
}
fin.close();
fin1.close();
label :
break;
}
// END OF SWITCH
}while( (ch>0 && ch<6)&& (ch=='y' ch=='Y') );}
// END OF MAIN
cout<<" If your choice is reservation , number to be
input is 1";
cout<<" Press any key to continue";
getch();
}
OUTPUT!!!!
MENU
1. Reservation
2. Queries
3. Cancellation
4. Help
5. Exit
Press any key to continue
Enter your choice: 1
SAHARA AIRLINES
RESERVATION/ ROUTE / FARE
|SN | FROM | TO | F.CODE | TIMING | DAY |FARE($)
| ARR|DEP|
|1 |LUCKNOW|DELHI|087|1530|1615|MONDAY|100|
|2|LUCKNOW|CHENNAI|0027|1200|130|THURSDAY|700
|3|DELHI|KOCHI| 1070| 1740|1830| FRIDAY| 730
|4|DELHI|BANGLORE|1007|2040|2100|SUNDAY|500
|5|LUCKNOW|BANGLORE|1017|1615|1700|MAONDAY|850
|6|ALLAHABAD|DELHI|7001|2045|910|SUNDAY|80
ENTRIES..
Flight Code: 0871
PERSONAL DETAILS
Name: Sunil Kumar
Address: M3\10, Nesthouse, Ambedkar Road,Naval
Base,CHME,Kochi-682004
Age: 30
Sex: M
From: Lucknow
To: Delhi
Press any key to continue.
Menu
1. Reservation
2. Queries
3. Cancellation
4. Help
5. Exit