Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

C++ image text in transcribed
image text in transcribed
"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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions