作业帮 > 综合 > 作业

C语言 编写三角形面积计算

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/28 11:56:43
C语言 编写三角形面积计算
/*计算三角形面积*/
#include
double sin(double x);
#define PI 3.14159265
int main()
{
double a,b,ang_c,s;
scanf("%lfa=3%lfb=4%lfc=45",&a,&b,&ang_c);
s = a * b * sin(ang_c * PI / 180.0) / 2.0;
printf("The area is %f\n",s);
return 0;
}
————————————————————————————————————————————————————————————————————————————————————————————
Linking...
求三角形面积.obj :error LNK2001:unresolved external symbol "double __cdecl sin(double)" sin@@YANN@Z)
Debug/求三角形面积.exe :fatal error LNK1120:1 unresolved externals
Error executing link.exe.
求三角形面积.exe - 2 error(s),0 warning(s)
#include <stdio.h>

#include <math.h>

//double sin(double x);

#define PI  3.14159265

int main()

{

 double a, b, ang_c, s;

 

 scanf("%lf %lf %lf", &a, &b, &ang_c);

 s = a * b * sin(ang_c * PI / 180.0) / 2.0;

 printf("The area is %f\n", s);

 return 0;

}

/*

要不然自己实现sin函数,否则引进math头文件

还有scanf 仔细看看,我怎么写的

*/