The elevator's current state is represented with two enumerated types and two structures
-
Initialization of elevator status (elevator is on the first floor and elevator door is closed)
-
Select whether the elevator continues to operate
-
Control the direction of the elevator each time it runs
-
Add floors during elevator operation
-
Input elevator floor number is out of order input
-
Determine if the elevator is overloaded
-
Increase or decrease the number of people in the elevator Macros define the maximum number of passengers and floor range in an elevator, and can modify MAX_FLOOR and MAX_NUM in elevator.c as needed
-
Finally, the elevator returns to its original state
MIT