char get_choice(void)
{
int ch;
printf("Enter the letter of your choice:\n");
printf("a. advice b.bell\n");
printf("c.count q.quit\n");
ch = get_first();
while ((ch <'a' || ch > 'c' ) && ch != 'q');
{
printf("please respond with a, b, c, or q.\n");
ch = get_first();
}
return ch;
}
char get_first(void)
{
int ch;
ch = getchar();
while (getchar() != '\n')
continue;
return ch;
}
第七行 error: get_first' was not declared in this scope 第十八行 error:
getchar' was not declared in this scope
没有思路
get_first函数要写在get_choice函数前面,否则在get_choice函数中调用get_first函数时会找不到
提前申明函数,可以在程序头文件下面对最后一个函数声明,要么就把最后一个函数放在第一个函数前面