Hello everyone, I'm really new to C++, and I'm just looking for any advice/suggestions/guidance on how to start an assignment I've got. Here's the actual description of the assignment:
"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 "FirstClass" and Please type 2 for "Economy". If the person types 1, your program should assign a seat in the first class section (seats 1-5). If the person types 2, your program should assign a seat in the economy section (seats 6-10). Your program should print a boarding pass indicating the person’s seat number and whetherit is in the first class or economy section of the plane. Use a one-dimensional 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. Your program should, of course, never assign a seat that has already been assigned. When the first class section is full, your program should ask the person if it is acceptable to be placed in the economy section (and vice versa). If yes, then make the appropriate seat assignment. If no, then print the message "Next flight leaves in 3 hours."
I can sadly admit that I'm not very good at coding at all, and as such, I'm not even really sure where to begin on this (even though for some, this is probably very simple), so I'm just looking for any advice to help get me started and point me in the right direction; anything is appreciated!
try thinking of it like a path, each option is a split in the path, so u would start with the first which splits at economy and first class( oh look, you could do a switch statement/if statement there). one thing i usually do is actually draw it out and then do functions for each step. that is my suggestion without actually doing code for you.
1- First, lay out the requirements into single sentences.
2 Group them together into small packets.
these will be your functions
3 Begin to lay out your plan in a pseudo code-like manner
( use pseudo-code - I use RATFOR - always have.)
4 Begin coding, first the global vars
then main() and what main() calls
then the func()'s - what they get for arg' s and what they return
This step only makes a shell of any code. The details arrive in step 5.
5 Begin to fill in the details of each fnc, including main(),
using a lot of comments and flags as you progress.
Note: if you take your teachers requirements and write them on paper,
then you can draw little boxes around some of the functions and what the functions are suppose to do.
such as ...
DISPLAY MENU options ()
- - 1 for FIRST
- - 2 for Econ
FIRST IS FULL()
ask to move
yes = move() else wait-msg()
Econ is full()
ask to move
yes = move() else wait-msg()
ask R U happy with seat?
yes = print-ticket() else get-a-chair()
check all-full()
if yes then fly() else get-next()
your 1-D array will be a headache at first, arrays always are, until you get to know them. 4-d arrays are a headache too, but you can also get use to them ( later) too.