hello guys. im in need of some urgent help over here. the case so far is like this:
the code below already checks if the user inputs a letter, it will be discarded. only numbers allowed.
now i need to enter another checking solution such as if (guess[0]>6)
in other words. i would like the invalid entry to pop up if a number aboe 6 is entered.
could someone please help me implement this into my code below. ive tried many solutions but all not working fine..
many thnx to anyone who helps.Code:valid1 = 0;
while (!valid1) {
printf("ENTER GUESS 1: ");
fflush (stdout);
if (scanf("%d",&guess[0]) == 1)
valid1 = 1;
else
printf("INVALID ENTRY, PLEASE TRY AGAIN\n\n");
while (getchar() != '\n');
}
greatly appreciated.
PS. sorry about the heading i was going to add more details but clicked on post too quickly.