Question: For C++: CODE MUST BE THOROUGHLY DOCUMENTED EXPLAINING EACH SECTION OF CODE. The object of this assignment is to have three cars that run a

For C++:

CODE MUST BE THOROUGHLY DOCUMENTED EXPLAINING EACH SECTION OF CODE.

The object of this assignment is to have three cars that run a race across the screen. Which one wins has to be truly random, which means the rand function alone will not work. You must initialize random function with srand seeded with time. The movement of the cars must be separated into leaps of no more than ten spaces at a given time using random function. The winner is determined by which car has moved 50 spaces or more unless there is tie in at which time you continue to add spaces until the tie is broken randomly. Place a one and a half seconds (1500 milliseconds) sleep in between leaps. Clear screen and redraw. Until there is a winner at which time you announce the winner and how many spaces the winner moved. Use functions, loops, switches etc as you see fit to avoid rewriting the same lines of code multiple times.

PLEASE SHOW CODE WORKS WITH A PICTURE.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!