Computers and Technology

Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class. Your program must prompt the user to enter the following information:a. Ticket type (first class, business class, or economy class) b. Desired seat
So far the code I have is ... now can I go about finishing to retreive the user input ? (This is for C++)
#include
#include
using namespace std;
int main()
{
int r, c;
char seat_resvr;
char tic_type;
char availability[13][6], reserved[2];
int row_num, col_num;
char seats;
cout << "A program that lets you choose your seating arrangement on an airplane";
cout << endl;
char A[13][6];
for (int r = 0; r < 13; r++)
{
for (int c = 0; c < 6; c++)
A[r][c] = '*';
}
/*int row, seat;
cin >> row >> seat;
A[row - 1][seat - 1] = 'X';*/
cout << " A B C D E F" << endl;
for (int r = 0; r < 13; r++)
{
cout << "Row" << setw(3) << r + 1 << " ";
for (int c = 0; c < 6; c++)
cout << A[r][c] << ' ';
cout << endl;
}
cout << endl << "* -- available seat" << endl
<< "X -- occupied seat" << endl << endl
<< "Rows 1 and 2 are for first class passengers." << endl
<< "Rows 3 through 7 are for business class passengers." << endl
<< "Rows 8 through 13 are for economy class passengers." << endl;
cout << "To reserve a seat enter Y/y (Yes), N/n(No):" << endl;
cin >> seat_resvr;
reserved[2] = 'X';
return 0;

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:20, Jadaaaaaaan
Your program will make use of long long int variables for all calculations. note: the use of long long int requires that you have c++11 support. you should have this automatically if you are using a newer version of visual studio. the support is there for gcc as well, but you may need the -std=c++11 or -std=c++0x compiler flag. you first need to read in the total number of seconds. there is no prompt for the read (that is, you just do the cin without using a cout to display a prompt). this is going to seem a little strange when you are running your program in your ide
Answers: 2
image
Computers and Technology, 23.06.2019 17:30, Annlee23
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
image
Computers and Technology, 23.06.2019 23:00, Maya629277
Lucas put a lot of thought into the design for his company's new white paper. he made sure to include repeating design elements such as color schemes and decorative images. his goal was to a. add symmetry b. create a unified publication c. provide consistency d. save money
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, hannahgracew12
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
Do you know the correct answer?
Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows...

Questions in other subjects:

Konu
Spanish, 31.12.2019 21:31