Sie sind auf Seite 1von 4

#include <iostream.

h>
#include <conio.h>
#include <fstream.h>
#include <iomanip.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <constream.h>
void reserve_seat();
void seat_reserve();
void flight_schedule();
void main_menu();
void add_res();
void add_f();
struct custom
{
char
fname[5000],nic[5000],clas[5000],origin[5000],destination[5000],f_name[5000],fl_n[5
000],org[5000],dest[5000];
void add_f()
{
ifstream read("f_s.txt",ios::app);
ofstream write("f_s.txt",ios::app);
cout<<endl;
cout<<"What is the no of the flight(in small letters): ";
gets(fl_n);
customer.fl_n[5000]=tolower(customer.fl_n[5000]);
cout<<endl;
cout<<"What is the flight's City of Origin: ";
gets(org);
cout<<endl;
cout<<"What is the flight's City of Destination: ";
gets(dest);
cout<<endl;
cout<<endl<<endl;
while(!read.eof())
{
cout<<endl;
write<<"Flight no: "<<customer.fl_n<<endl;
write<<"City Of Origin: "<<customer.org<<endl;
write<<"City Of Destination: "<<customer.dest<<endl<<endl;
break;
}
read.close();
write.close();
cout<<endl;
cout<<"Flight Schedule Successfully updated !"<<endl;
getch();
main_menu();
}
void add_res()
{
ifstream read("s_r.txt",ios::app);
ofstream write("s_r.txt",ios::app);
cout<<"What is the customer's full name: ";
gets(fname);
cout<<endl<<endl;
cout<<"What is the customer's N.I.C(National Identification Card
Number): ";
gets(nic);
cout<<endl;
cout<<"What is the customer's Chosen Class(First Class or Economy
Class): ";
gets(clas);
cout<<endl;
cout<<"What is the customer's Flight No(in small letters): ";
gets(f_name);
customer.f_name[5000]=tolower(customer.f_name[5000]);
cout<<endl;
cout<<"What is the customer's City of Origin: ";
gets(origin);
cout<<endl;
cout<<"What is the customer's City of Destination: ";
gets(destination);
cout<<endl;
cout<<endl<<endl;
while(!read.eof())
{
cout<<endl;
write<<"Customer's Name: "<<customer.fname<<endl;
write<<"N.I.C(National Identification Card No):
"<<customer.nic<<endl;
write<<"Flight No/Class:
"<<customer.f_name<<"/"<<customer.clas<<endl;
write<<"City Of Origin: "<<customer.origin<<endl;
write<<"City Of Destination: "<<customer.destination<<endl<<endl;
break;
}
read.close();
write.close();
cout<<endl;
cout<<"Seat Successfully reserved !"<<endl;
getch();
main_menu();
}

};
custom customer;
void main()
{
clrscr();
main_menu();
getch();
}
void main_menu()
{
clrscr();
int code;
cout<<" Welcome To My Project !"<<endl;
cout<<endl;
cout<<" Zain's Flight Reservation System"<<endl;
cout<<endl;
cout<<" Main Menu :"<<endl;
cout<<endl;
cout<<" Code: Option:"<<endl;
cout<<endl;
cout<<" 1 Seat Reservations."<<endl;
cout<<endl;
cout<<" 2 Flight Schedule. "<<endl;
cout<<endl;
cout<<" 3 Add a Reservation."<<endl;
cout<<endl;
cout<<" 4 Add a Flight."<<endl;
cout<<endl;
cout<<" 5 Exit"<<endl;
cout<<endl;
cout<<"Please, enter any of those codes to select that specific option: ";
cin>>code;
if (code==1)
{
cout<<endl;
seat_reserve();
getch();
}
if (code==2)
{
cout<<endl;
flight_schedule();
}
if (code==3)
{
cout<<endl;
reserve_seat();
}
if (code==4)
{
cout<<endl;
customer.add_f();
}
if (code==5)
{
exit(1);
}
else if (code!=1 || code!=2 || code!=3 || code!=4 || code!=5)
{
cout<<endl;
cout<<"Code Error !, Please enter from any of the above given Option
codes"<<endl;
getch();
main_menu();
}
}
void seat_reserve()
{
clrscr();
char ch[100];
ifstream read("s_r.txt");
cout<<" Seat Reservations:"<<endl;
cout<<endl;
while(!read.eof())
{
read.getline(ch,100);
cout<<ch;
cout<<endl;
}
read.close();
cout<<endl<<endl;
cout<<"Press any key to go back to the Main Menu !"<<endl;
getch();
main_menu();
}
void flight_schedule()
{
clrscr();
char ch[100];
ifstream read("f_s.txt");
cout<<" Flight Schedule:"<<endl;
cout<<endl;
while(!read.eof())
{
read.getline(ch,100);
cout<<ch;
cout<<endl;
}
read.close();
cout<<endl<<endl;
cout<<"Press any key to go back to the Main Menu !"<<endl;
getch();
main_menu();
}
void reserve_seat()
{
clrscr();
char ch,choice;
cout<<" Seat Reservations:"<<endl;
cout<<endl;
cout<<endl<<endl;
cout<<endl;
customer.add_res();
main_menu();

Das könnte Ihnen auch gefallen