# include <stdio.h>
# include <iostream>
# include <string.h>
# include <stdlib.h>
# include <conio.h>
void menu (int s,int c);
void reserve (int s,int c);
void date (int s,int c);
void seat (int s,int c);
void list (int s, int c);
void insert ();
int counter,status;
struct{
char destination[20];
struct {
char lname [20];
char fname [20];
char gender [7];
char add [50];
int age;
char num[15];
int seat[10];
char day[10];
char month[10];
char year[10];
int ticket[10];
}people[100];
}place[10];
void main ()
{ int counter=0,status=0;
system("cls");
menu (status,counter);
}
void menu (int s,int c) {
char ch;
do {
system("cls");
puts("[1]Reserve a Flight:\n[2]List of Reserve:\n[3]Exit:");
printf("Enter Choice...!");
ch=getch ();
switch (ch) {
case '1': reserve (s,c); break;
case '2': list (s,c); break;
case '3': exit (0);
}}
while (ch!='4');
}
void reserve (int s,int c) {
int t,ick=10;
system("cls");
if (s<10 || c<100){
printf("Where Whould You Like to Go?");
scanf("%s",place[s].destination);
printf("First Name:");
scanf("%s",&place[s].people[c].fname);
printf("Last Name:");
scanf("%s",&place[s].people[c].lname);
printf("Age:");
scanf("%d",&place[s].people[c].age);
printf("Contact Number:");
scanf("%s",&place[s].people[c].num);
printf("Address:");
scanf("%s",&place[s].people[c].add);
printf("Gender:");
scanf("%s",&place[s].people[c].gender);
for (t=0;t<10;t++){
place[s].people[c].ticket[t]=1+(rand()%ick);}
ick=+2;
date (s,c);}
else
printf("OoOoOoOpPpPpPssss sorry theirs no vacant flight 4 u!!\n\n");
getch ();
}
void date (int s,int c) {
system("cls");
printf("When you Want to set the Flight?\n");
printf("Enter Month...!");
scanf("%s",&place[s].people[c].month);
printf("\nEnter Date...!");
scanf("%s",&place[s].people[c].day);
printf("\nEnter Year...!");
scanf("%s",&place[s].people[c].year);
seat (s,c);
}
void seat(int s,int c){
system("cls");
printf("Try to Pick Your Seat # (1-10)..!");
scanf("%d",&place[s].people[c].seat[s]);
s++;
c++;
menu (s,c);
}
void list (int s, int c){
int x,y;
system("cls");
if (c>0 && s>0) {
for (x=0,y=0;x<s,y<c;x++,y++){
if (x==s && y==c ) break;
printf("\n\nName:%s,%s\n",place[x].people[y].lname,place[x].people[y].fname);
printf("Gender:%s\n",place[x].people[y].gender);
printf("Address:%s\n",place[x].people[y].add);
printf("Age:%d\n",place[x].people[y].age);
printf("Contact #:%s\n",place[x].people[y].num);
printf("Seat #:%d\n",place[x].people[y].seat[x]);
printf("Destination:%s\n",place[x].destination);
printf("Date of Flight:%s-%s-%s",place[x].people[y].month,place[x].people[y].day,place[x].people[y].year);
printf("\nTicket #:%d\n\n",place[x].people[y].ticket);
}}
else {
puts("Sorry! theirs no reservation Enter yet!");}
getch ();
}