السسلأم عليكم ورحمة الله وبركآته
كيفكم , ان شاء الله طيبين :
انا احتاج مسسآعده ( الله يوفق ويخلي اللي يسسآعدني )
آبغى احد يكتب لي هذا الكود بـلغه ++c
مآعرفت له :blush:
هذا هو
Project Title:
Simple Flight Seating Arrangement Program
Description:
The seating arrangement of a flight is presented by five lines. Each line contains four integers, a value of 1 represents a reserved seat, and a value of 0 represents an empty seat. The following is an example of the flight seating arrangement:
0 1 1 1
1 1 0 0
0 0 0 1
1 1 1 1
1 0 1 0
Write an interactive program which has a menu with the following options:
1. Show number of empty seats
2. Show empty seats
3. Reserve a seat 4. Cancel a seat // Optional Part (BONOUS)
5. Exit the program
The program first reads the data from the user and stores the data in one-dimensional integer array SEATS of size 20, then:
a. If option 1 is chosen, the main function passes the array SEATS to an integer function NEMPTY which returns the number of empty seats. Then the main function prints this number.
b. If option 2 is chosen, the main function passes the array SEATS to a void function ESEATS which prints the positions of all empty seats. The seat position means the row number and the column number of the seat.
c. If option 3 is chosen, the user is prompted to enter the row number and the column number of the seat to be reserved. The main function then passes these two numbers together with the array SEATS to a logical function RESERV which reserves a seat if it is empty and returns the value true (1) to the main function. If the requested seat is already reserved or if the row or column number is out of range, the function returns the value false (0) to the
CS 240 (2nd Semester 1432-1433H) Project 2 of 3
main function. The main function then prints the message SEAT RESERVED or SEAT NOT AVAILABLE respectively.
d. [Optional Part ]If option 4 is chosen, the user is prompted to enter the row number and the column number of the seat to be canceled. The main function then passes these two numbers together with the array SEATS to a logical function CANCEL which cancels a seat if it is reserved and returns the value true (1) to the main function. If the requested seat is already empty or if the row or column number is out of range, the function returns the value false (0) to the main function. The main function then prints the message SEAT CANCELED or WRONG CANCELLATION respectively.
e. If option 5 is chosen, the main function stops immediately.
Hints:
Given the seat position as row number n and column number m, the corresponding array subscript i can be calculated as follows:
i = (n – 1) * 4 + (m - 1)
For example, the status of seat (2,4) is sorted in SEATS [7].
Given the array subscript i, the corresponding seat position as row number n and column number m can be calculated as follows:
n = (i / 4) + 1
m = (i % 4) + 1
For example, SEATS [12] contains the status of seat (4,1).
Where 1 n 5, 1 m 4, 0 i 19, and status means reserved (value 1) or empty (value 0).
بليييز , اخر يوم تسلميه الاربعاء هذا ولأ باخذ زيرو :mad: