# Problem in writing a program using C

#### kencool1

Joined Aug 22, 2007
3
Dear all,
I am learning C programming by myself using some books and notes from the internet.
I have got stuck in writing a program as I dont know where to start writing it...
Can someone please help me by writing a program using C to implement the following airline reservation system.
Can I have a reply from anyone as soon as possible...

The program is as followed:

A small airline that operates flights to one destination uses a computer system to:

1) Provide an enquiry system regarding the number and type of seats available for a flight on a specified day.

2) Issue a single ticket to a passenger containing the following information:

a) Name of destination
b) Types of seat booked, i.e., first or tourist class.
c) Departure, arrival times and date
d) Cost of ticket
e) Name of passenger

3) Output a passenger list for each flight.

The following have to be assumed:
1. There is only one flight per day at different times over a period of five days. The airline operates from Monday to Friday only. The duration of the flight is 2 hours.

2. Every aeroplane used has a maximum of 50 seats, the distribution of first class seats to tourist class seats being 10 and 40 respectively.

3. A seat is bookable up to one week in advance but not on the day of the flight.

4. The cost of the first class seat is $500, whilst that of a tourist class seat is$250.

#### beenthere

Joined Apr 20, 2004
15,819
You may find that a flowchart will help a lot in getting started. By diagramming every step in the process, you will see what things the code needs to accomplish. It sounds tedious, but correcting bad code is no fun, either. The flowchart lets you do program development in a controlled fashion - now this works, so I can try to do the next step.

You also break it down into small modules. Like setting up screens to input passenger names and travel dates. That lets you start assigning variables that can be referenced in other parts of the program. It's easy to combine the small steps as the program grows.

#### Mark44

Joined Nov 26, 2007
628
It sounds like you haven't been able to start in on this, but can you give us some idea of what you've learned already about C? E.g., that you know how to do input and output, know about variable types, that you know some control structures such as loops, and so on. Letting us have an idea of where you are can make it easier for us to help you write this.
Mark

#### kencool1

Joined Aug 22, 2007
3
I have learn if-else statements, switch staement, break statement, continue statement,
Loop: while, do-while, for.
Variable: global and local.
I know also how to input and ouput (scanf, printf)

If you will not be able to do the program, can you at least write the pseudocodes for me please.

#### mik3ca

Joined Feb 11, 2007
189
create functions and then use them in your program. This prevents your code from appearing as endless.

Or, if you really want to learn C and you want to do it hard-core electronics style, Let me introduce you to a device that starts with a C. It is a CAPACITOR.

#### Papabravo

Joined Feb 24, 2006
13,972
That is a fiarly ambitious program to use for learning a language. I suggest you start with something smaller. I also note that it would require a fair amount of effort with very little payoff for one of the members to do it for you.

#### beenthere

Joined Apr 20, 2004
15,819
Please remember that the program and the grade are yours. We can provide guidance - see above - but it's up to you to make the effort for the grade.