I'm really a beginner in C++ programming, and the above problem is just a part of c++ excercise. Can somebody give me a tip how to implement this in C++?
The biggest problem for me is to implement and write this:
• red+yellow light on cat traffic light is 2 sec duration
• yellow light on car traffic light is 2 sec duration
• the red on car trafffic light and red on pedestrian traffic light (the simultanuous red light) is 3 sec
How to put wait. The programme just need to write on above probem on the screen.
How can I do this?.. Please if someone can give me example or tip or write a few lines of c++ code, any help would be appreciated.
Thanks.
Traffic light table:
Car traffic light state Pedestrian traffic light state
red green
red red
red+yellow red
green red
yellow red
red red
Traffic lights work like this:
• green light on car traffic light is min. 5 secunds duration, and max Tc=30 sec.
• green light on pedestria traffic light is min. 5 secunds duration , and max. Tp=10 sec
• if there are more then 5 pedestrians on pedestrian traffic light before Tc (30 sec duration for car) the light on traffic light is changing so pedestrians can pass.
• If there are more then 5 cars on car traffic lights before Tp (min. 10 sec. For pedestrians) the light on traffic light is changing so cars may pass
• red+yellow light on cat traffic light is 2 sec duration
• yellow light on car traffic light is 2 sec duration
• the red on car trafffic light and red on pedestrian traffic light (the simultanuous red light) is 3 sec
The first state that is the 2nd state in the table (red for car and red for pedestrians).