当局者已晕找不出哪里出错,求旁观者指出错误在哪
PE14_10.obj : error LNK2019: 无法解析的外部符号 "int __cdecl menu(void)" (?menu@@YAHXZ),该符号在函数 _main 中被引用
程序代码:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
float add(float x, float y);
float subtract(float x, float y);
float multiply(float x, float y);
float divide(float x, float y);
int menu(void);
int getlet(char *);
int main(void)
{
float(*pf)(float x, float y); //函数指针
int choice;
float x, y;
while ((choice = menu()) != 'e')
{
switch (choice)
{
case 'a': pf = add; break;
case 'b': pf = subtract; break;
case 'c': pf = multiply; break;
case 'd': pf = divide; break;
}
printf("Please enret x y:");
while (scanf("%f%f", &x, &y) !=2)
printf("Error! Please enret x y:");
printf("%.2f\n", pf(x,y));
}
return 0;
}
int meun(void)
{
puts("Enter menu choice:");
puts("a) +");
puts("b) -");
puts("c) *");
puts("d) /");
puts("e) Quit");
return getlet("abcde");
}
int getlet(char * str)
{
char c;
c = tolower(getchar());
while (strchr(str, c) == NULL)
{
printf("Please enter (%s)\n", str);
while (getchar() != '\n');
c = tolower(getchar());
}
while (getchar() !='\n');
return c;
}
float add(float x, float y)
{
return (x + y);
}
float subtract(float x, float y)
{
return (x - y);
}
float multiply(float x, float y)
{
return (x * y);
}
float divide(float x, float y)
{
return (x / y);
}









