Can someone guide me how to correct this program.

1. Airline Reservation System
Green Dot airline has just purchased a computer for its new automated reservation
system. You have been asked to program the new system. You are to write a program to
assign seats on each flight of the airline’s only plane. Assume the plane has 6 rows with 2
seats in each row. First 4 rows make up the non-smoking section, and the last 2 rows the
smoking section.
(a) Display a menu system as follows :-
 If choice is A, Add a person to the flight or waiting list.(see part 2)
 If choice is B, Remove a passenger from the flight. (see part 4)
 If choice is C, Display Seating arrangment (see part 5)
 If choice is D, Display the waiting list
 If choice is E, Quit from the system.
(b) Create your own screen design or use this design as follows:
GREEN DOT AIRLINE ON LINE RESERVATION SYSTEM
(A) Reserve a seat
(B) Cancel a reservation
(C) Display Seating arrangement
(D) View Waiting List
(E) Quit
>> Enter Choice : XX
2. Reserve a seat
When a customer want to reserve a seat, you should do following:
a) Request for passenger’s name
b) Ask passenger’s preference: smoking or non-smoking
c) Check if any seats of selected category (smoking/non-smoking) are available. If
yes, allocate a seat and printout a ticket.
d) If seats in selected area is not available, check if there is any seat in the other
section, if yes, ask whether customer wants to be in the other section. If yes,
allocate the seat, and printout a ticket. Otherwise, put him/her in the waiting list,
and display a message like “Sorry, the flight is full. You will be put in the waiting
list….”
e) Enter date of transaction.
3. Cancel a reservation
When a customer wants to cancel a reservation, the program will do following.
a) Request for the passenger’s name
b) Search the seating chart for passenger’s name and delete it.
c) If the waiting list is empty, update the array so that the seat is available for the
other bookings
d) If the waiting list is not empty, get the first person in the waiting list who opted
for the same seating category, and allocate the seat to them. Print out the ticket.
4. Display Seat arrangement
Create your own output screen design to show the seating arrangement.
Non smoking area:
=====================
Seat1 Seat2
Row 1: Mr. John Mrs John
Row 2 Mary Lim Jeffery Tan
Row 3 Gottman Bernald
Row 4 Thomas Dennis
Smoking area:
=====================
Seat1 Seat2
Row 1: Tina T Ashly
Row 2: Clinton Hoffman

5. Display the waiting list
Design your output to show the waiting list. The following is an example:
Waiting List:
=====================
Lim Choong Meng 14-Feb-1999 non-smoking
Fan Wong 14-Feb-1999 non-smoking
Phua Choo Kang 15-Feb-1999 smoking
I have already done this but have some question through it.

#include<string.h>
#include<stdio.h>
void main()
{
void reservation();
void cancelseat();
void Displayseat();
void view_waiting_list();
int i=0;
char choice;
int count=0;
char name[80];
char seatn[6][2][80];
char waiting[10][80];
do {
printf("GREEN DOT AIRLINE ON LINE RESERVATION SYSTEM\n");
printf("(A) Reserve a seat\n");
printf("(B) Cancel a reservation\n");
printf("(C) Display Seating arrangement\n");
printf("(D) View Waiting List\n");
printf("(E) Quit\n");
printf("ENTER CHOICE : ");
scanf("%c", &choice);
switch(choice)
{
case 'A' :reservation();
break;
case 'B' :cancelseat();
break;
case 'C' :Displayseat();
break;
case 'D' :view_waiting_list();
break;
case 'E' :printf("Ended");
break;
default :printf("Error Input");
}
return;
}while(choice!='E');
}

void reservation()
{
int count=0;
int waitinglist=0;
int row,seat,rw,r,s,x,se;
char name[80];
char smoke;
char seatn[6][2][80]={'\0'};
char waiting[10][80]={'\0'};
printf("Enter Passenger Name: ");
scanf("%s",&name);
printf("Non-smoking Area(Y/N): ");
scanf("%s",&smoke);
if (smoke =='Y')
{
printf("Enter row you want(1/2/3/4)");
scanf("%d",&r);
printf("Enter seat you want(Seat(1/2)");
scanf("%d",&s);
if(1<=r<=4 && 1<=s<=2)
{
rw=r-1;
se=s-1;
if(seatn[rw][se][80] == '\0')
{
strcpy (seatn[rw][se],name);
printf("Seat has been saved");
count++;
return ;
}
else if(seatn[rw][se][80] != '\0')
{
printf("Not available now");
}
else if(count==0)
{
strcpy (waiting[x],name);
x++;
printf("Sorry, the flight is full. You will be put in the waiting list¡K.");
waitinglist++;
}
}
else
{
printf("Error Input");
}
}
else if (smoke =='N')
{
printf("Enter row you want(1/2)");
scanf("%d",&r);
printf("Enter seat you want(1/2)");
scanf("%d",&s);
if(1<=r<=2 && 1<=s<=2)
{
rw=r+3;
se=s-1;
if(seatn[rw][se][80] == '\0')
{
strcpy (seatn[rw][se],name);
printf("Seat has been saved");
count++;
}
else if(seatn[rw][se][80] !='\0')
{
printf("Not available now");
}
else if(count==0)
{
strcpy (waiting[x],name);
x++;
printf("Sorry, the flight is full. You will be put in the waiting list¡K.");
waitinglist++;
}
}
else
{
printf("Error Input");
}
}
return;
}

void cancelseat()
{
char seatn[6][2][80];
int count,seat,row,i;
int option;
char cancelname[80];
char waiting[10];
int waitinglist=0;
printf("Cancel Reservation\n");
printf("(1) Cancel Reserved Seat\n");
printf("(2) Cancel Queue In Waiting List\n");
printf("(3) Return To Previous Screen\n");
printf("Enter Choice: ");
scanf("%d",&option);
if ( option == 1 )
{
printf("Enter Passenger Name: ");
scanf("%s",&cancelname);
for(seat= 0; seat<=4; seat++)
{
for(row = 0; row <=2; row++)
{
if (strcmp(seatn[row][seat],cancelname)==0)
{
seatn[row][seat][80]='\0';
count--;
printf("Your Reservation Has Been Cancelled.Thank You And We Hope To See You Again.");
}
}
}
}
else if ( option == 2 )
{
printf("Enter Passenger Name: ");
scanf("%s",&cancelname);
i--;
waitinglist--;
printf("Your Waiting List Has Been Cancelled.Thank You And We Hope To See You Again.");
}
else if ( option == 3 )
{
return;
}
else
{
printf("Error Input");
}
return;
}

void Displayseat()
{
char seatn[6][2][80];
int row,seat;
printf("Non smoking area:\n=====================\n");
printf("\t\t\tSeat 1\t\tSeat 2\n");
for(row= 0; row<=4; row++)
{
for(seat = 0; seat <=2; seat++)
{
printf("Row %d\t\t%s\t\t%s\n",row,seatn[seat][row]);
}
}
printf("Smoking area:\n=====================\n");
printf("\t\t\t\tSeat 1\t\tSeat 2\n");
for(row= 5; row<=6; row++)
{
for(seat = 0; seat <=2; seat++)
{
printf("Row %d\t\t%s\t\t%s\n",row,seatn[seat][row]);
}
}
return;
}



void view_waiting_list()
{
char waiting[10][80];
printf("Waiting List\n===================");
int no;
for(no= 0; no<10; no++)
printf("%s\n",waiting[no]);
return;
}
http://www.cplusplus.com/forum/beginner/1/

You're posting way too much information.

Be specific about what you're struggling with and post only the relevant code (use code tags too). The good folks on this forums don't always have time time to trawl through paragraphs of information.
Topic archived. No new replies allowed.