Question: Write a C++ program name: Horse Race Write a program that runs a random horse race. The specification: There are three horses. During each round,
Write a C++ program name: Horse Race
Write a program that runs a random horse race. The specification: There are three horses. During each round, a random number from 1 to 100 is generated for each horse. The horse advances one length if the random number is greater than 50. My track is 15 lengths long. Show the track this way:
1|--------H------| 2|-------H-------| 3|------------H--|
Write a function ShowHorse() that takes a horse number (1 to 3) and a position on the track, and shows the current position of the horse. Have the program run until one of the horses reaches the finish line.
If you don't want the previous track to appear on the screen you can use: system("clear") to clear the screen but you will need to add the following include statement:
#include
#include
You can end a program at anytime using the code: return 0
Step by Step Solution
3.42 Rating (146 Votes )
There are 3 Steps involved in it
C include include include using namespace std void ShowHorseint horse int position for int i 1 i 50 ... View full answer
Get step-by-step solutions from verified subject matter experts
