①
#include
#define _USE_MATH_DEFINES
#include
int main()
{
float r,s;
s=rrM_PI;
printf("s=%f\n",s);
return 0;
}
②
#include
int main()
{
int l,w,s;
scanf("%d%d",l,w);
s=l*w;
printf(l,w,s);
}
供参考:
//①
//#include <math.h>
#include <stdio.h>
#define M_PI 3.1415926//修改
int main()
{
float r, s;
scanf("%f", &r); //修改
s = r * r * M_PI;
printf("s=%f\n", s);
return 0;
}
//②
#include<stdio.h>
int main()
{
int l, w, s;
scanf("%d%d", &l, &w);
//scanf("%d%d", l, w); 修改
s = l * w;
printf("%d*%d=%d", l, w, s);
//printf(l, w, s); 修改
return 0;
}
第一个代价是完整的吗?
第二个:
①scanf("%d%d",l,w);应该改为scanf("%d%d",&l,&w);
② printf(l,w,s);改为printf("%d %d %d",l,w,s);
③后面还加上return 0;不加也可以运行,但是加上符合规范!
第一个的s赋值那个地方是不是少了星号
第二个少return语句
第一个,s=rrM_PI,你是少了个星号吗,还有后面那个是啥
第二个,scanf那里,要加取地址符号&,scanf("%d%d",&l,&w);
printf那里,要加输出类型,printf("%d%%d%d",l,w,s);