Hello all. I've encountered a problem with some code I'm using and I was looking for some help. The code is:
Code:
temp = 0;
while (temp < 1 || temp > 7) {
system("CLS");
printf("Race selection\n--------------\n");
printf("1. Human\n2. Dwarf\n3. Elf\n4. Gnome\n"
"5. Half-Elf\n6. Half-Orc\n7. Halfling\n");
printf("Race: ");
scanf("%i", &temp);
}
My problem is that if the user enters a letter (I tested 'a'), then the program loops infinitely. This is not the case if the user enters numbers, as far as I can see. When numbers are entered the form re-appears as expected.
Any help is appreciated