I have a function called rounds that that carries out a round for a two player guessing game the score is calculated based on the time taken and the attempts used
void rounds(int rand, int guess)
{
int attempts=1;
const int MAX_ATTEMPTS = 5;
int score;
long int timetaken;
time_t startTime,endTime;
while(attempts <= 5)
{
if (rand==guess)
{
printf("Congratulations,You are correct!\n");
time(&startTime);
break;
}
if ((unsigned int)(rand-guess) >40)
{
printf("You are Cold\n");
}
else if (10<=(unsigned int)(rand-guess))
{
printf("You are Warm\n");
}
else if ((unsigned int)(rand-guess) < 10)
{
printf("You are Hot!\n");
}
}/*endwhile*/
time(&endTime);
timetaken=endTime-startTime;
++attempts;
score += 5*(MAX_ATTEMPTS - attempts)*exp(5.0)/timetaken;
}
Firstly i'm getting an error when I call the rounds function into main, "term does not evaluate to a function taking two arguments" I checked the prototype and the definition but I'm not seeing it.
Second I want store the score for the round for each player and then at the end of a round display a winner should the function return the score?