This is the code I have so far. I can't even get the numbers range to print to the screen correctly. I am very new to all this stuff so go eacy on me. Can anyone help??
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
int main()
{
unsigned int lo, hi;
int comp;
double tries = 0;
double guess = 0;
printf ("Please enter two integers for the range:\n");
scanf ("%d%d", &lo, &hi);
srand (time(0));
comp = lo + rand() % (hi - lo);
printf ("I'm thinking of a number between %d and %d!\n", lo, hi);
scanf ("%f", &guess );
while (guess != comp);
{
if (guess < comp)
{
printf ("Your guess was too low. Try again.\n");
scanf ("%f", &guess);
tries++;
}
else if (guess > comp)
{
printf ("Your guess was too high. Try again.\n");
scanf ("%f", &guess);
tries++;
}
}
printf ("Nice job! You got it in %f tries.\n", tries);
return 0;
}
Any help is very much appreciated.