I have this tortoise and hare project. I'm having trouble with moving the hare and testing it's position. Am I doing anything else wrong?
Code:#include <iostream> using std::cout; using std::endl; #include <cstdlib> #include <ctime> #include <iomanip> using std::setw; const int RACE_END = 70; double movetortoise ( int x ) double movehare ( int y ) double printCurrentPositions ( int t, int h ) int main() { int tortoise = 1; int hare = 1; int timer = 0; srand( time( 0 ) ); cout << "ON YOUR MARK, GET SET\nBANG !!!!" << "\nAND THEY’RE OFF !!!!\n"; // controls race while ( tortoise != RACE_END && hare != RACE_END ) { movetortoise ( x ) movehare ( y ) printCurrentPositions ( t, h ) ++timer; } // end while // determine winner if ( tortoise >= hare ) cout << "\nTORTOISE WINS!!! YAY!!!\n"; else cout << "Hare wins. Yuch.\n"; cout << "TIME ELAPSED = " << timer << " seconds" << endl; return 0; } // end main // move tortoise double movetortoise ( int x ) { int x = 1 + rand() % 10; // determine which move to make if ( x >= 1 && x <= 5 ) // fast plod turtlePtr += 3; else if ( x == 6 || x == 7 ) // slip turtlePtr -= 6; else // slow plod ++( turtlePtr ); // ensure that tortoise remains within subscript range if ( turtlePtr < 1 ) turtlePtr = 1; else if ( turtlePtr > RACE_END ) turtlePtr = RACE_END; } // end function moveTortoise // move hare double movehare ( int y ) { int y = 1 + rand() % 10; /* Write statements that move hare */ /* Write statements that test if hare is before the starting point or has finished the race */ } // end function moveHare // output positions of animals double printCurrentPositions ( int t, int h ) { if ( bunnyPtr == snapperPtr ) cout << setw( bunnyPtr ) << "OUCH!!!"; else if ( bunnyPtr < snapperPtr ) cout << setw( bunnyPtr ) << "H" << setw( snapperPtr - bunnyPtr ) << "T"; else cout << setw( snapperPtr ) << "T" << setw( bunnyPtr - snapperPtr ) << "H"; cout << "\n"; } // end function printCurrentPositions