1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include<iostream>
#include<string>
#include <iomanip>
using namespace std;
// constant values
const int ROW = 9;
const int COL = 4;
int row, seat;
// list of functions
void displayPlane (char layout[ROW][COL]);
int getSeats (istream row, ostream seat);
int main ()
{
// initial plane layout
char layout[ROW][COL] = { { 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' },
{ 'A', 'B', 'C', 'D' }};
// call function to getSeats (which will also displayPlane)
// I have no idea how to do this part... It's supposed to be a call by reference I think, but I'm lost as to how to set the function call.
istream row;
ostream input_col;
getSeats(istream row, ostream seat);
}
// this is what my professor sent me and said I'm required to use, but I don't understand.
void displayPlane(char layout[ROW][COL])
{
cout << endl << " Chesapeake Airlines" << endl << endl;
for (int i = 0; i < ROW; i++) {
cout << " " << i + 1 << " ";
for (int j = 0; j < COL; j++) {
cout << " " << layout[i][j] << " ";
}
cout << endl;
}
return;
}
/*
I'm also supposed to use this to check if the seat is taken, which makes sense, but she said to put this part in the main?
if(layout[r][c] != 'X')
This was how she said I need to count the total seats sold. There are three different classes, so I think that's
the part in the curly brackets, but I don't get how the counter actually works.
int classCtr[CTR] = {0,0,0}; */
|