Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. const int NUM_ROWS = 12;
  8. const int NUM_COLS = 6;
  9.  
  10.  
  11. void printChart(int array[NUM_ROWS][NUM_COLS])
  12. {
  13. string space = " ";
  14. string row = "Row";
  15. cout << space << "A" << space << "B" << space << "C" << space << space << "D" << space << "E" << space << "F" << endl;
  16. for (int i = 0; i < 12; i++)
  17. {
  18. if(i < 9)
  19. {
  20. cout << row << i + 1 << " ";
  21. }
  22. else
  23. {
  24. cout << row << i + 1 << endl;
  25. }
  26. cout << array[i][0] << space << array[i][1] << space << array[i][2] <<space << space << array[i][3] << space << array[i][4] << array[i][5];
  27. }
  28. }
  29.  
  30. void emptyCount(int array[NUM_ROWS][NUM_COLS])
  31. {
  32. for (int numRows = 0; numRows < NUM_ROWS; numRows++)
  33. {
  34. for(int numCols = 0; numCols <NUM_COLS; numCols++)
  35. {
  36. array[numRows][numCols] = '*';
  37. }
  38. }
  39. }
  40.  
  41.  
  42. int main()
  43. {
  44. int userInput = 0;
  45. string options[] = {"What would you like to do?", "1. Print Chart", "2. Fill Seat", "3. Empty count", "4. Exit"};
  46.  
  47. for ( int i = 0; i < 5; i++)
  48. {
  49. cout << options[i] << endl;
  50. }
  51.  
  52.  
  53.  
  54. int airplaneSeatingChart [NUM_ROWS] [NUM_COLS];
  55.  
  56. cin >> userInput;
  57.  
  58. while (userInput < 0 || userInput > 4)
  59. {
  60. cout << "Please enter one of the options." << endl;
  61. cout << "What would you like to do next?" << endl;
  62. cout << "1. Print chart" << endl;
  63. cout << "2. Fill Seat" << endl;
  64. cout << "3. Empty Count" << endl;
  65. cout << "4. Exit" << endl;
  66. cin >> userInput;
  67. }
  68.  
  69. while (userInput < 4 && userInput > 0)
  70. {
  71. if (userInput == 3)
  72. {
  73. emptyCount(airplaneSeatingChart);
  74. for ( int i = 0; i < 5; i++)
  75. {
  76. cout << options[i] << endl;
  77. }
  78. cin >> userInput;
  79. }
  80. else if (userInput == 2)
  81. {
  82. // my function
  83. for ( int i = 0; i < 5; i++)
  84. {
  85. cout << options[i] << endl;
  86. }
  87. cin >> userInput;
  88. }
  89. else if (userInput == 1)
  90. {
  91. printChart(airplaneSeatingChart);
  92. for ( int i = 0; i < 5; i++)
  93. {
  94. cout << options[i] << endl;
  95. }
  96. cin >> userInput;
  97. }
  98. if (userInput == 4)
  99. {
  100. return 0;
  101. }
  102. }
  103.  
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement