473,728 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to write airline reservation system program in c.

10 New Member
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
6 22560
9,065 Recognized Expert Moderator Expert
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.

Nov 10 '08 #2
2 New Member
this solution is for visual basic

[ off topic spoonfeeding solution deleted ]
Jan 1 '09 #3
9,208 Recognized Expert Moderator Expert
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
2 New Member
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....assign ments are given to be done....
i don't care
devil programmer
Jan 1 '09 #5
11,448 Recognized Expert MVP
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
Tassos Souris
152 New Member
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
  5. // initialize the seats[] to all zero if it is not already
  7. // Read what the user wants (1 or 2) checking input.. Use a combination of
  8. // fgets() and strtol()
  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
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

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

Similar topics

by: Shane | last post by:
I am working on an airline res system. The technologies I am using are a mysql backend with Java and JSP pages pulling information. It is quite straight forward on my system to for example book a direct flight from Dublin to London for example. eg. Dublin -> London What I am finding more difficult is creating a system where if there are no direct flights then the system is intelligent enough to pick the most direct routes. So for...
by: Robert | last post by:
Would you use Access to create a car rental reservation system? I would think that the complexity of such a system would be better suited to a procedural language like Visual Basic or C++. Your thoughts, please. Robert
by: windandwaves | last post by:
Hi Folk Is there anyone out there in a hotel reservation system. I have written one over the last few years and I would like to know if anyone has a similar interest. > Nicolaas
by: hiboo | last post by:
Does anyone know of any open source java software/code libraries for doing travel/airline reservations? I'm looking for a typical airline (hotel, car rental?) reservation system. system in perl or c, c++ ok.
by: Roy27 | last post by:
Hi, Can somebody please confirm if "Hertz Rent A Car" company's reservation system has XML API to develop software for integration with other 3rd party software? I apologize if I am putting the question in a wrong group? Thanks Manik
by: tabloidster | last post by:
Howdy All, I recall seeing a similar post a while back, but I'm not an expert VB programmer so I'm still not clear... For my VB6 class, I've got to code a basic reservation system. Let's say that the plane has 6 passenger seats total via 2 columns (A and B for arguements sake) and 3 rows per column. An array here, right? We have to display a seating chart, which I could probably setup with labels and set the caption property with green...
by: cotty | last post by:
AIRLINE RESERVATION SYSTEM A small airline has just purchased a computer for its new automated reservations system. The president has asked you to program the new system in C. You are to write a program to assign seats on each flight of the airline’s only plane (capacity: 20 seats). Your program should display the following menu alternatives: Please type 1 for “business” Please type 2 for “economy” If the person types 1, then your...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.