C++ Question: For each tick of the clock (i.e. for each repetition of a loop), d
ID: 645720 • Letter: C
Question
C++ Question:
For each tick of the clock (i.e. for each repetition of a loop), display a 70-position line showing the letter T in the tortoise's position and the letter H in the hare's position. Occasionally the race participants land on the same square. In this case, the tortoise bites the hare and your program should display OUCH I !!!!! beginning at that position. All other positions other than the T, the H, or the OUCH !!!!! (in case of a tie) should be blank. After displaying each line, test whether either animal has reached or passed square 70. If so, display the winner and terminate the simulation. If the tortoise wins, display: TORTOISE WINS!!! YAY!!! If the hare wins, display: hare wins, yuch. If both animals win on the same click tick, you will want to display: It?s a tie. If neither animal wins, perform the loop again to simulate the next tick of the clock.Explanation / Answer
#include #include #include #include #include using namespace std; const int End=70; //constant fixed integer for the entire game. void MoveTurtoise (int *); void MoveHare (int *); void PrintPosition (int *, int*); int main() { int Tortoise = 1; int Hare = 1; int Time = 0; srand(time(0)); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.