Question: Use C language to write a program. The program is used to assign seats on a train(100 seats). And the following menu should be shown
Use C language to write a program. The program is used to assign seats on a train(100 seats). And the following menu should be shown in the program: Enter A for "A-Class", enter B for "B-Class", and enter C for "C-Class".
The Program should assign a seat from 1-10 in A-Class section if the user types A, and the program should assign a seat from 11-30 in B-Class section if the user types B.The program should assign a seat from 31-100 in C-Class section if the user types C.
The program should print a ticket include the user's seat number and whether it is in A-Class, B-Class, or C-Class section of the train. Please use a single subscripted array to represent the seating chart of the train.
Initialize all elements of the array to 0 to indicate that all seats are empty. If all seats are assigned, set the corresponding element of array to 1 if the seat is no longer available.
The program should never assign a seat that already been assigned. When one class section is full, the program should ask the user if he/she can choose other seat sections. If the answer is yes, make the appropriate seat assignment. If it's no, then show "We are booked."
Please use C language
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
