I think that it's good you tried and came back - however this is a
pretty basic program so rather than give you the answers I'll
point you in the direction of what you will need to know and how
to structure the program and teach yourself how to do it.
Here goes - all links taken from the tutorials at this site:
If Statements - study these in detail
Loops - particularly the for loop - useful with arrays
Functions - learn about passing arguments and returning values
If you read the above articles, you should learn some skills which
will help you in the program.
Here's what you need your program to do:
1) Program starts - should ask the user to enter a choice - 1 for
smoking, 2 for non - smoking
2) pass this choice to a function. Use an if statement to
decide which part of the plane you want to look at
3) having done the above, use a for loop to print out details of
the seats occupied - use an if statement to check if each element
(seat) in you array is set to 0 - if it is, print out that it is free -
if not, print out that it is booked
4) Now the user should be given a choice to book a seat - they
enter a number to indicate their choice
5) pass this number to a function - this function should use an
if statement to check if that seat is free (has a 0 stored at that
element) or is booked (has a 1, or some other value stored
at that element). If it is free - set it to 1 - if not, print that the
seat has been booked.
That is basically the task you have set for yourself, with all the
main steps flagged - what you have done is similar to steps
1 - 3, but they can be done with a better approach by leaving
the program doing the work using loops - also it can be achieved
using 1 function as opposed to your current approach using 2.
(HINT passing the choice to a function that can print out details
for both sections of the plane)
Just take it all one step at a time - If statements are very much
the key to doing a program like this IMO. Take it slow and
come back if you run into problems