hi all i m beginner to c++ and thus find very hard copin with arrays....
heres my question from the assignmnet.. hmmm i am kind a lost and i dont no wut to do ....could anyone tell me what to do !!!!
seeking immediate help!!
heres is my question
A small airline has just purchased a computer for its new automated reservations 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 (capacity: 10 seats).
Your program should display the following menu of alternatives -Please type 1 for "First class" and Please type 2 for "Economy". If the person types 1, your program should assign a seat in the first class section (seats 1-5). If the person types 2, your program should assign a seat in the economy section (seats 6-10). If the user enters a different number then return an error message and prompt the user to enter another number. Your program should print a boarding pass indicating the person's seat number and whether it is in the first class or economy section of the plane. Your program should of course never assign a seat that has been assigned. Use an array to represent the seating chart of the plane. The seats are available if the corresponding position in the array has the value 0. Set the position to 1 to indicate that the corresponding seat has been assigned.
heres my code (screwed up tho!!)
CODE
#include<iostream>
#include<iomanip>
using namespace std;
void first_class(int[],int);
//void int econ_class(int[],int);
int main()
{
const int max_size=5;
int first[max_size]={0,0,0,0,0};
//int economy[max_size]={0,0,0,0,0};
int value,size=0;
cout<<"please enter 1 for first class and 2 for econcomy class"<<endl;
cin>>value;
if (value==1){
first_class(first,max_size);
cout<<"thr things ar"<<endl;
for (int i=0;i<max_size;i++)
cout<<first[i]<<endl;
}
if ((value!=1)&&(value!=2))
cout<<"error"<<endl;
//if (size==max_size)
//cout<<"sorry! seats already full"<<endl;
return 0;
}
void first_class(int b[],int max_size)
{
for (int k=0;k<max_size;k++)
b[k]=5;
}