解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<math.h>
double distance(float x1, float y1, float x2, float y2)
{
double juli = sqrt(pow((x1-x2),2) + pow((y1-y2),2));
return juli;
}
int main()
{
float x1,x2,x3,y1,y2,y3;
double a,b,c,s,p;
scanf("%f%f",&x1,&y1);
scanf("%f%f",&x2,&y2);
scanf("%f%f",&x3,&y3);
a = distance(x1, y1, x2, y2);
b = distance(x1, y1, x3, y3);
c = distance(x2, y2, x3, y3);
p=(a+b+c)/2;
s = sqrt(p*(p-a)*(p-b)*(p-c));//海伦公式
printf("%.2lf\n",s);
return 0;
}
0.0分
1 人评分
#include<stdio.h> #include<math.h> double distance(float x1, float y1, float x2, float y2) { double juli = sqrt(pow((x1-x2),2) + pow((y1-y2),2)); return juli; } int main() { float x1,x2,x3,y1,y2,y3; double a,b,c,s,p; scanf("%f%f",&x1,&y1); scanf("%f%f",&x2,&y2); scanf("%f%f",&x3,&y3); a = distance(x1, y1, x2, y2); b = distance(x1, y1, x3, y3); c = distance(x2, y2, x3, y3); p=(a+b+c)/2; s = sqrt(p*(p-a)*(p-b)*(p-c));//海伦公式 printf("%.2lf\n",s); return 0; }#include<stdio.h> #include<math.h> double distance(float x1, float y1, float x2, float y2) { do
#include<stdio.h> #include<math.h> double distance(float x1, float y1, float x2, float y2) { double juli = sqrt(pow((x1-x2),2) + pow((y1-y2),2)); return juli; } int main() { float x1,x2,x3,y1,y2,y3; double a,b,c,s,p; scanf("%f%f",&x1,&y1); scanf("%f%f",&x2,&y2); scanf("%f%f",&x3,&y3); a = distance(x1, y1, x2, y2); b = distance(x1, y1, x3, y3); c = distance(x2, y2, x3, y3); p=(a+b+c)/2; s = sqrt(p*(p-a)*(p-b)*(p-c));//海伦公式 printf("%.2lf\n",s); return 0; }#include<stdio.h> #include<math.h> double distance(float x1, float y1, float x2, float y2) { do
IP判断 (C语言代码)浏览:820 |
模拟计算器 (C语言代码)浏览:2366 |
输入输出格式练习 (C语言代码)浏览:773 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:501 |
C语言训练-求素数问题 (C语言代码)浏览:630 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)(标记法)浏览:709 |
1273题解浏览:527 |
Manchester- 陶陶摘苹果浏览:4832 |
WU-C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:783 |
蛇行矩阵 (C++代码)浏览:607 |