This is what I have tried
It would always act as false no matter the input
How could I do it right in a simple way if possible and why doesn't it work?
I am trying to create a condition that would ask if the scanned user input is one of the numbers and if not it asks them to only write one of the shown numbers and shows what the options are.
void konc()
{
exit (0);
}
void scan()
{
int ch = 0;
printf("0 - \n");
printf("1 - \n");
printf("2 - \n");
printf("3 - \n");
printf("4 - \n");
printf("5 - \n");
printf("6 - \n");
printf("7 - \n");
scanf("%d", &ch);
while (isdigit(int(ch)) == false || ch < 0 || ch > 7){
printf("Must be one of the numbers\n");
fflush(stdin);
scan();
}
if (ch == 0){
konc();
}
printf("%d", ch);
scan();
}
int main()
{
scan();
return 0;
}