Can't get this to compile for some reason. Anyone have an idea what's going on with it?
#include <iostream.h>
#include <stdlib.h>
#include <iomanip.h>
#include <time.h>
void MoveT(int *tortoisePtr, const int End_race);
void MoveHare(int *harePtr, const int End_race);
void PrintCurrentPosition(const int *snapperPtr, const int *bunnyPtr, const int End_race);
int main()
{
const int End_race=70;
int tortoise=1,hare=1,timer=0;
cout<<"BANG!!!"<<endl;
cout<<"AND THEY'RE OFF !!!!"<<endl;
srand(time(NULL));
while(tortoise != End_race && hare != End_race)
{
MoveT(&tortoise,End_race);
MoveHare(&hare,End_race);
PrintCurrentPosition(&tortoise,&hare,End_race);
timer++;
}
if(&tortoise>=&hare)
cout<<"tortoise wins: ";
else
cout<<"hare wins: ";
cout<<timer<<endl;
return 0;
}
void MoveT(int *tortoisePtr, const int End_race)
{
int ranNum;
ranNum = (rand()%10)+1 ;
if(ranNum>=1 && ranNum<=5)
*tortoisePtr += 3;
else if(ranNum == 6 || ranNum == 7)
*tortoisePtr -= 6;
else
*tortoisePtr += 1;
if (*tortoisePtr<1)
*tortoisePtr=1;
else if(*tortoisePtr>End_race)
*tortoisePtr=End_race;
}
void MoveHare(int *harePtr, const int End_race)
{
int hrandNum;
hrandNum= (rand()%10)+1;
if(hrandNum ==3 || hrandNum ==4)
*harePtr +=9;
else if(*harePtr==5)
*harePtr -=12;
else if(hrandNum>=6 && hrandNum<=8)
*harePtr +=1;
else if(hrandNum>8)
*harePtr -=2;
if(*harePtr<1)
*harePtr=1;
else if(*harePtr>End_race)
*harePtr=End_race;
cout<<endl;
}
void PrintCurrentPosition(const int *snapperPtr, const int *bunnyPtr, const int End_race)
{
if(*snapperPtr == *bunnyPtr)
cout<<setw(*bunnyPtr)<<"OUCH!!";
else if(*snapperPtr<*bunnyPtr)
{
cout<<setw(*bunnyPtr)<<'H';
cout<<setw(*snapperPtr-*bunnyPtr)<<'T';
}
else
{
cout<<setw(*snapperPtr)<<'T';
cout<<setw(*bunnyPtr-*snapperPtr)<<'H'<<endl;
cout<<endl;
}
}
}