醋泡野姜的功效与作用?:这个题错哪了?

来源:百度文库 编辑:中科新闻网 时间:2024/05/08 11:58:58
#include <stdio.h>
#include<math.h>
void main()
{
double m,n;
double s,len;
double (*p)(double,double);
double area(double x,double y),length(double x,double y);
double f(double a,double b,double (*pa)(double ,double));
printf("Please enter 2 values:");
scanf("%lf,%lf",&m,&n);
p=area;
s=f(m,n,p);
p=length;
len=f(m,n,p);
printf("Area of this right triangle is :.2lf\n",s);
printf("Length of this hypotenuse is:%.2lf\n",len);
double area(double a,double b)
{
return (a+b)/2;
}
double length(double a,double b)
{
return sqrt(a*a+b*b);
}
double f(double a,double b,double (*pa)(double,double))
{
double y;
y=(*pa)(a,b);
return y;
}
getch();
}
老说第18行语法错了,可我看了没错啊!那是错哪了?

您都研究到这儿啦,厉害,佩服,我是一点也不懂啊!但进来了,不得不说话!

因为你把函数声明写进了主函数里.
就是这些
double (*p)(double,double);
double area(double x,double y),length(double x,double y);
double f(double a,double b,double (*pa)(double ,double));
把他们放出来再试试.
还有他们所定义的函数也放到主函数外面.