English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

•Only one car can be crossing at any given time.
•A car should be allowed to cross the intersection only if there are no cars coming from the other street.
When cars are coming from both sides, they should take turns to prevent indefinite postponements in either street.

Can the above question be coded in C++ and how?

2007-04-24 08:47:54 · 2 answers · asked by kibwe p 1 in Science & Mathematics Engineering

2 answers

It can be programmed in C++.
Use an array for location, speed, and acceleration of cars on each street (You need acceleration to have a reasonable simulation with starts & stops.) Use a random number generator to load & reload the array and assign starting speeds. Don't forget to simulate a clock. You also need to design an output. Will it be a video display, hardcopy, or a file for later viewing?

2007-04-24 18:10:08 · answer #1 · answered by Helmut 7 · 0 0

definite! My track of the day is that this Turbulance is eye-catching - You Me At Six one million. Justin Bieber, that ********. My acquaintances are keen approximately that making a track bloody fetus. Atleast there is alot of human beings that mock and hate Bush... 2. Dunno? perchance that thoroughly irrelevant dance Johnny Depp does on the tip of Alice... 3. Tina you fats lard! 4. I want i became Robert Smith's grand daughter. think of of the connections! in basic terms right acquaintances... possibly Frank Iero and Gabe Saporta. 5. Yess! suitable now i'm crushing perplexing on Zacky Vengeance from Avenged Sevenfold. Oh gawd. Ian Watkins from the Lostprophets is a relentless one too :) 6. Umm... sometime by potential of the Strokes 9. 4 years in the past... Ohh gross. I had a terrible style, i think of I had my Kayne West fest. and Chris Brown and Cassie. i do no longer prefer to think of roughly it! BQ11. What track did you final have on your head?

2016-12-23 04:00:51 · answer #2 · answered by manzer 4 · 0 0

fedest.com, questions and answers