Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Our contenders begin the race at \"square 1\" of 70 squares. Eachsquare represen

ID: 3616148 • Letter: O

Question

Our contenders begin the race at "square 1" of 70 squares. Eachsquare represents a possible position along the race course. The finish line isat square 70. The first contender to reach or pass square 70 is rewarded with apail of fresh carrots and lettuce. The course weaves its way up the side of aslippery mountain, so occasionally the contenders lose ground.

There is a clock that ticks once per second. With each tick ofthe clock, your program should adjust the position of the animals according tothe rules in Fig. 8.38.

Use variables to keep track of the positions of the animals(i.e., position numbers are 170). Start each animal at position 1 (i.e., the"starting gate"). If an animal slips left before square 1, move the animal backto square 1.

Generate the percentages in the preceding table by producing arandom integer i in the range 1 <= i <= 10. For the tortoise, perform a "fast plod"when 1 <= i <= 5, a "slip" when 6 <= i <= 7 or a "slow plod" when 8 <= i <= 10. Use a similar technique to move thehare.

Begin the race by printing

For each tick of the clock (i.e., each repetition of a loop),print a 70-position line showing the letter T in the tortoise'sposition and the letter H in the hare's position. Occasionally, thecontenders land on the same square. In this case, the tortoise bites the hareand your program should print OUCH!!! beginning at that position. Allprint positions other than the T, the H or theOUCH!!! (in case of a tie) should be blank.

After printing each line, test if either animal has reached orpassed square 70. If so, print the winner and terminate the simulation. If thetortoise wins, print TORTOISE WINS!!! YAY!!! If the

Explanation / Answer

please rate - thanks #include #include #include using namespace std; void movetort(int*); void movehare(int*); void print(int*,int*); int main() {int finish=70,tort=1,hare=1,rtime=0; srand(time(0)); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote