还有没有其他的做法啊?
#include "stdio.h"main()
{
float x,y,s;
float area(float x,float y);
scanf ("%f%f",&x,&y);
s=area(x,y);
printf("the area is : %.2f\n",s);
}
float area(float x,float y)
{
float z;
z=x*y;
return z;
}
搜索更多相关的解决方案:
做法
----------------解决方案--------------------------------------------------------
这是一种.
#include<stdio.h>#define area(x,y) x*y
AREA(float AR)
{
return AR;
}
void main()
{
float x,y,z;
scanf("%f,%f",&x,&y);
AREA(area(x,y));
z=AREA(area(x,y));
printf("%f\n",z);
}
----------------解决方案--------------------------------------------------------
这一种
#include<stdio.h>#define area(x,y) x*y
void main()
{
float x,y;
scanf("%f,%f",&x,&y);
printf("%f\n",x?area(x,y):y);
}
----------------解决方案--------------------------------------------------------
输出加.2f.
----------------解决方案--------------------------------------------------------
#include "stdio.h"
main()
{
float x,y,s;
scanf ("%f %f", &x, &y);
s = x * y;
printf("the area is : %.2f\n",s);
}
----------------解决方案--------------------------------------------------------
#define area(x,y) ((x)*(y))
----------------解决方案--------------------------------------------------------