|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <math.h>
int main(void)
{
float a;
float b;
float c;
float p;
float area;
printf("请输入程序的三条边长:");
scanf_s("%f,%f,%f",& a, & b,& c);
p = 0.5 * (a + b + c);
area = sprt(p * (p - a) * (p - b) * (p - c));
printf("a=%f,b=%f,c=%f,p=%f\n",a,b,c,p);
printf("area=%f\n", area);
return 0;
}
你是不是警告这样:
- a.c: In function 'main':
- a.c:13:9: warning: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
- 13 | scanf_s("%f锛锛",& a, & b,& c);
- | ^~~~~~~
- | scanf
- a.c:16:16: warning: implicit declaration of function 'sprt'; did you mean 'sqrt'? [-Wimplicit-function-declaration]
- 16 | area = sprt(p * (p - a) * (p - b) * (p - c));
- | ^~~~
- | sqrt
复制代码
如果是的话,
第一个警告提示你把 scanf_s 换成 scanf,
第二个警告说你sqrt写成了sprt
|
|