0
int main()
{

srand(time(NULL));
int randInt{};
int hare = 0;
int tortoise = 0;
int count = 0;

//displys BANG AND THEY ARE OFF at the start of the race
cout << "BANG !!!!! \nAND THEY'RE OFF !!!!!" << endl;

do 
{
    haresTurn(randInt, hare);
    tortoisesTurn(randInt, tortoise);

    positions(&hare, &tortoise);
    count++;
} 
while (hare < 70 && tortoise < 70);

//if hare reaches position 70 first displays a message
if (hare >= 70)
{
    cout << "Hare wins.Yuck" << endl;
}
//if tortise reaches postion 70 first displays a message
if (tortoise >= 70)
{
    cout << "TORTISE WINS!!!YAY!!!" << endl;
    cout << "The loop went " << count << " times" << endl;
}
else if(hare = 70 & tortoise = 70)
{
    cout << "Its a tie" << endl;
}
return 0;

but I need to try and display the last things as a separate entity is that it's a tie to follow these directions:

If the hare wins, display Hare wins. Yuch. If both animals win on the same clock tick, you may want to favor the tortoise (the “underdog”), or you may want to display. It’s a tie. If neither of the animals wins, perform the loop again to simulate the next tick of the clock.

all I'm getting is an expression that it must be a modifiable value error and am not sure how to fix it in the last else if statement.

1 Answers1

0

Comparisons in C++ need to be done with the == operator, and the AND statement is the && operator.

Using hare == 70 && tortoise == 70 in the condition should make it work.