| hangman.c - The function askUser of main. | Lecture 1 - slide 3 : 22 Program 4 |
answer askUser(char *question){
char ch;
do {
printf("%s [y/n]? ", question);
while (isspace(ch = fgetc(stdin)));
if (ch == 'y')
return yes;
else if (ch == 'n')
return no;}
while (ch != 'y' || ch != 'n');
}