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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started