Hi I am new to C and have to do an assignment for a class. I have a rough idea how I am going to do it, but the program isn't behaving the way I want it to.
I ask the user to enter a number using scanf
int user = 1; // User Defined Number, initialized to 1
char answer = ' '; // The player's answer
int computer = 50;
// If the User does not enter a digit, value is 1 by default
printf("Please select a number between 1 and 100\n");
then the computer asks if their number is above below or equal to another number:
printf("Is your number smaller than, equal to, or greater than %d? (enter <, =, > respectfully)", computer);
When I run the program, it ends before the second scanf happens.....I don't understand why.
I looked on google and someone suggested flushall(); I don't know what this does.
Any help would be appreciated