This is where I'm currently at and I've looked up code very similar to this but they all seem to have something different that sets them apart. I feel like my mistake is right in front of me yet I'm too blind to see it.
Here is my code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time(NULL));
int rnum = 1 + rand() % 1000;
int guess = 0;
char answer;
printf("Would you like to play (y or n)?\n");
scanf_s("%c", &answer);
while (answer == 'y')
{
printf("I have a number between 1 and 1000.\n");
printf("Can you gueess my number?\n");
printf("Please type your first guess.\n");
scanf_s("%d", &guess);
while (rnum != guess)
{
if (rnum > guess)
{
printf("Too low. Try again.\n");
scanf_s("%d", &guess);
}
else
{
printf("Too high. Try again.\n");
scanf_s("%d", &guess);
}
}
printf("Execellent! You guess the number!\n");
printf("Would you like to play again (y or n)?\n");
scanf_s("%c", &answer);
}
return 0;
}