Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- const int NUM_ROWS = 12;
- const int NUM_COLS = 6;
- void printChart(int array[NUM_ROWS][NUM_COLS])
- {
- string space = " ";
- string row = "Row";
- cout << space << "A" << space << "B" << space << "C" << space << space << "D" << space << "E" << space << "F" << endl;
- for (int i = 0; i < 12; i++)
- {
- if(i < 9)
- {
- cout << row << i + 1 << " ";
- }
- else
- {
- cout << row << i + 1 << endl;
- }
- cout << array[i][0] << space << array[i][1] << space << array[i][2] <<space << space << array[i][3] << space << array[i][4] << array[i][5];
- }
- }
- void emptyCount(int array[NUM_ROWS][NUM_COLS])
- {
- for (int numRows = 0; numRows < NUM_ROWS; numRows++)
- {
- for(int numCols = 0; numCols <NUM_COLS; numCols++)
- {
- array[numRows][numCols] = '*';
- }
- }
- }
- int main()
- {
- int userInput = 0;
- string options[] = {"What would you like to do?", "1. Print Chart", "2. Fill Seat", "3. Empty count", "4. Exit"};
- for ( int i = 0; i < 5; i++)
- {
- cout << options[i] << endl;
- }
- int airplaneSeatingChart [NUM_ROWS] [NUM_COLS];
- cin >> userInput;
- while (userInput < 0 || userInput > 4)
- {
- cout << "Please enter one of the options." << endl;
- cout << "What would you like to do next?" << endl;
- cout << "1. Print chart" << endl;
- cout << "2. Fill Seat" << endl;
- cout << "3. Empty Count" << endl;
- cout << "4. Exit" << endl;
- cin >> userInput;
- }
- while (userInput < 4 && userInput > 0)
- {
- if (userInput == 3)
- {
- emptyCount(airplaneSeatingChart);
- for ( int i = 0; i < 5; i++)
- {
- cout << options[i] << endl;
- }
- cin >> userInput;
- }
- else if (userInput == 2)
- {
- // my function
- for ( int i = 0; i < 5; i++)
- {
- cout << options[i] << endl;
- }
- cin >> userInput;
- }
- else if (userInput == 1)
- {
- printChart(airplaneSeatingChart);
- for ( int i = 0; i < 5; i++)
- {
- cout << options[i] << endl;
- }
- cin >> userInput;
- }
- if (userInput == 4)
- {
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement