Question: C++ Write a program about the race between the rabbit and the turtle. Use random numbers to develop a simulation. Begin the race at square
"Write a program about the race between the rabbit and the turtle. Use random numbers to develop a simulation. Begin the race at square 1 of 70 Each square represents a position along the course of the race with the end line at square 70. The clock ticks once per second adjusting the position of both each time. Begin the race by printing: Bang !!!! And they're off!!! Start each animal at position 1 If animal slips left before square 1, move back to square 1 For each tick of the clock (repetition of the loop), print a 70-position line showing the letter T for turtle and R for rabbit. If both land in same square the turtle bites the rabbit and program prints OUCH!!! beginning at that position All print positions other than the T, R or OUCH!!! should be blnk After each line, determine whether either animal has reached or passed square 70. If so, print name of winner, terminate. If turtle wins print: Turtle Wins!!! Yay!! If Rabbit wins: Rabit wins. Yuch. If neither, perform loop again to simulate the next tick of the clock. We will work on this problem during class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
