By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,505 Members | 1,761 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,505 IT Pros & Developers. It's quick & easy.

how to write airline reservation system program in c.

P: 10
A small airline has just purchased a computer for its new automated reservations system. You have been asked to program the new system. You are to write a program to assign seats on each flight of the airline's only plane (capacity: 10 seats).
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(seats 1 - 5).If the person types 2, your program should assign a seat in the non-smoking section (seats 6 - 10). Your program should then display a boarding pass indicating the person's seat number and whether it is in the smoking or non-smoking section of the plane.

Use an 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 of the array to 1 to indicate that the seat is no longer available
Nov 10 '08 #1
Share this Question
Share on Google+
6 Replies


Banfa
Expert Mod 5K+
P: 8,916
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

Banfa
Administrator
Nov 10 '08 #2

P: 2
this solution is for visual basic
ENJOY

[ off topic spoonfeeding solution deleted ]
Jan 1 '09 #3

weaknessforcats
Expert Mod 5K+
P: 9,197
To devilprogrammer: This is a C/C++ forum. Visual Basic is not spoken here nor can you post complete solutions. Please do as Banfa asks and follow the posting guidelines.
Jan 1 '09 #4

P: 2
i found it while searching in Visual Basic its solution but there was no solution available for it so i built this program for myself .... & thought why not to share it with others so they can get full marks....assignments are given to be done....
i don't care
Regards
devil programmer
Jan 1 '09 #5

Expert 10K+
P: 11,448
@devilprogrammer
This forum doesn't care about your off topic solution either so it has been deleted. Full marks are only to be deserved for original work, not for copying and pasting other people's spoonfeeding; don't do that anymore.

kind regards,

Jos (moderator)
Jan 1 '09 #6

100+
P: 152
I think that the remark of the exercise already gives the solution:
Expand|Select|Wrap|Line Numbers
  1. int seats[ 11 ]; // if you want to start counting from 1 
  2. int smoking = 1; // where the seats for the Smoking-Category start
  3. int nonsmoking = 6; // where the seats for the Non-Smoking Category start
  4.  
  5. // initialize the seats[] to all zero if it is not already
  6.  
  7. // Read what the user wants (1 or 2) checking input.. Use a combination of
  8. // fgets() and strtol()
  9.  
  10. // If user wants the Smoking Category
  11.     // If there are more available seats for the smoking category 
  12.               (in which bounds should the smoking variable be?)
  13.         // Notify the user about the reservation (user fprintf())
  14.         // Update the seats[] array (assign 1 to the taken seat)
  15.     // Else (no more seats)
  16.         // Notify the user that no more seats are available (use fprintf())
  17.         // Use your own strategy here... you can ask user if he wants a seat
  18.         // in the Non-Smoking Category
  19.     // EndIf
  20. // Else (the user wants the Non-Smoking Category)
  21.     // The same as above (except you use the nonsmoking variable instead
  22.     // of the smoking variable
  23. // EndIf
  24.  
After you implement the above simple algorithm you can of course change it to use less if's and make it better,,,, It's up to you...

Hope i helped!
Jan 10 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.