First of all - forgive the formatting of the code in this forum, but I cut/pasted from the complier straight into this forum. If anyone can give me a hand, it would be greatly appriciated. I desparately need help in working with Char array, and passing value in and out of functions. The 'putInCoach' function is not working, and needs help.
thanks,
Tim
//Lab 0
//Airline Reservation Program
/************************************************** *********************************/
#include <stdio.h>
#include <iostream.h>
#include <string.h>
using namespace std;
/*************************Prototype Declarations************************************/
void getCoachClassReservations();
void putInCoach(char *coachClassSeat);
/************************************************** *********************************/
int main ()
{
char selection; //varible for usr menu selection
char coachClassSeat[30][2]; //array for last name of Coach Passenger
do
{
cout << "*****Wheezer Airlines Reservations****"<<endl;
cout << "* *"<<endl;
cout << "* 1. Display all reservations *"<<endl;
cout << "* 2. Make First Class Reservations *"<<endl;
cout << "* 3. Make Coach Class Reservations *"<<endl;
cout << "* 4. Exit/Logout *"<<endl;
cout << "* *"<<endl;
cout << "**************************************"<<endl<<en dl;
cin >> selection;
if(selection=!'1' || selection!='2' || selection!='3' || selection!='4')
{
cout << "INVALID INPUT"<<endl;
cout << "Please enter 1-4"<<endl;
cin >> selection ;
}
else;
if(selection=='3')
{
putInCoach(&coachClassSeat[30][2]);
}
else;
}
while(selection!='4');
return 0;
}
void putInCoach(char *coachClassSeat)
{
for(int x=0; x<4; x++)
{
if (&coachClassSeat[x] != 0)
{
cout << "Seat is availble for Passenger wanting to fly Coach Class"<<endl;
cout << "Enter Passenger Last Name"<<endl;
cin >> coachClassSeat[0];
}
else
cout << "ALL SEATS ARE TAKEN"<<endl;
}
}