(Airline Reservation System)
A small airline has just purchased a computer for its new automated reservation system. You have been asked to program the new system. You are to write a program that assigns seats on each flight of the airline’s only plane (capacity 10 seats)
1. Your program should display the following menu of alternatives
Please type 1 for smoking
Please type 2 for non-smoking
If the person types 1,
Your program should assign a seat in the smoking section (seat 1-5)
If person types 2,
Your program should assign a seat in the non-smoking section (seat 6-10)
2. Your program should print a Boarding Pass indicating the person seats number and whether it is smoking or non-smoking section of plane.
3. Use a single subscripted array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seat is assigned set the corresponding elements to 1 to indicate that seats s no longer available.
Write a Program in c++ that use functions and arrays in this program....this program use for air line company.
You're almost there. You have your logic all set. Now all you have to do is write it in C++.
Reply:No one can give yuo complete code, for hints visit http://codesbyshariq.blogpsot.com
Reply:#include %26lt;stdlib.h%26gt;
#include %26lt;iostream.h%26gt;
#include %26lt;conio.h%26gt;
int smoking[5] = { 0 };
int nonsmoking[5] = { 0 };
int assigned = 0;
int
main(int argc, char* argv[])
{
while (1) {
cout %26lt;%26lt; "Please type 1 for \"SMOKING \"\n"
" 2 for \"NON-SMOKING\"\n"
" 3 to quit\n";
int command = 0;
cin %26gt;%26gt; command;
int *seat_class = 0;
if (command == 1)
seat_class = smoking;
else if (command == 2)
seat_class = nonsmoking;
else if (command == 3)
exit(0);
int found = 0;
for (int i=0; i%26lt;5; i++) {
if (seat_class[i] == 0) {
found++;
assigned++;
seat_class[i]++;
cout %26lt;%26lt; "\n*************************************...
cout %26lt;%26lt; "\n\n";
cout %26lt;%26lt; "\nBOARDING PASS\n";
cout %26lt;%26lt; "\n";
if(seat_class == smoking)
cout %26lt;%26lt; "SEAT " %26lt;%26lt; i+1 %26lt;%26lt; " SMOKING SECTION\n";
else
cout %26lt;%26lt; "SEAT " %26lt;%26lt; i+6 %26lt;%26lt; " NON-SMOKING SECTION\n";
cout %26lt;%26lt; "\n\n ";
cout %26lt;%26lt; "**************************************\...
if (assigned %26gt;= 10)
exit(0);
break;
}
}
if (!found)
cout %26lt;%26lt; "\n*** This section is full ***\n\n";
}
getch();
}
Reply:May be you can contact a C++ expert at websites like http://oktutorial.com/ to help you code your project assignment.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment