c语言有一个warning,如何去掉, 5
#include<stdio.h>#include<math.h>floatarea(inta,intb){return(float)a*b/2;}floatlength...
#include<stdio.h>
#include<math.h>
float area(int a,int b)
{
return (float)a*b/2;
}
float length(int a,int b)
{
return sqrt(a*a+b*b);
}
main()
{
int m,n;
float s,l;
float (*f)(int,int);
scanf("%d%d",&m,&n);
f=area;
s=(*f)(m,n);
f=length;
l=(*f)(m,n);
printf("area=%.2f,length=%.2f\n",s,l);
} 展开
#include<math.h>
float area(int a,int b)
{
return (float)a*b/2;
}
float length(int a,int b)
{
return sqrt(a*a+b*b);
}
main()
{
int m,n;
float s,l;
float (*f)(int,int);
scanf("%d%d",&m,&n);
f=area;
s=(*f)(m,n);
f=length;
l=(*f)(m,n);
printf("area=%.2f,length=%.2f\n",s,l);
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询