Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help in modifying my code. I'm on my final step already. I'm struggling with how to display the final output when the user

I need help in modifying my code. I'm on my final step already. I'm struggling with how to display the final output when the user is done choosing the tickets he or she has reserved and how do I add an exit option? Lastly Im having trouble to display when the user picked the wrong class and row.

#include #include #include #include using namespace std; int main(int argc, char *argv[]) { int airplane[13][6]; char airchar[13][6]; string ticket; int row[2]; char seat; //-------------------------------------------- for(int i = 0; i < 13; i++) { for(int j = 0; j < 6; j++) { airchar[i][j] = '*'; airplane[i][j] = 0; } } //-------------------------------------------- for(;;) { cout<<"MEGA AIRLINES!"<>ticket; cout<<"Desired Row: "; cin>>row[0]; cout<<"Enter Desired Seat (A,B,C,D,E or F): "; cin>>seat; switch(seat) { case 'A': case 'a': row[0] = row[0] - 1; row[1] = 1; row[1] = row[1] - 1; break; case 'B': case 'b': row[0] = row[0] - 1; row[1] = 2; row[1] = row[1] - 1; break; case 'C': case 'c': row[0] = row[0] - 1; row[1] = 3;

row[1] = row[1] - 1; break; case 'D': case 'd': row[0] = row[0] - 1; row[1] = 4; row[1] = row[1] - 1; break; case 'E': case 'e': row[0] = row[0] - 1; row[1] = 5; row[1] = row[1] - 1; break; case 'F': case 'f': row[0] = row[0] - 1; row[1] = 6; row[1] = row[1] - 1; break; } if(ticket == "FC") { if(row[0]+1 == 1 || row[0]+1 == 2) { if(airplane[row[0]][row[1]] == 0) { airplane[row[0]][row[1]] = 1; airchar[row[0]][row[1]] = 'X'; } else if(airplane[row[0]][row[1]] == 1) { cout<<"Message: Apologies but Seat "<

{ airplane[row[0]][row[1]] = 1; airchar[row[0]][row[1]] = 'X'; } else if(airplane[row[0]][row[1]] == 1) { cout<<"Message: Apologies but Seat "<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions

Question

What are the common types of life and health insurance?

Answered: 1 week ago

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago