hey everyone i am working on a tic tac toe game were i randomly generate a board when the user inputs a non negative number. so first i have to validate that the user actaully inputed a number and not a letter or a negative number. so far i cant get the program to recognize if the input is negative. but it will recognize if the input is a letter though.
here is my code
even though i have the if(scanres < 0)
void input(int* num1);
void input(int* num1)
bool success = false;
printf("\nPlease enter a non-negative number seed: ");
scanres = scanf("%d", &num1);
if(scanres < 0)
printf("\nYou entered a negative number.");
else if (scanres == 1)
success = true;
else if (scanres == 0)
printf("\nEnd of data stream.");
for some reason it wont recogive that its negative and any negative number passes as true.
please help...the project is due wensday