如果点A(x1,y1)、点B(x2,y2)则AB的距离为 ∣AB∣=√[(x1-x2)2+(y1-y2)2] 代码: #include<stdio.h> #include<math.h> int main() { int x1,y1,x2,y2,x3,y3; //任意三点坐标 double lenght1,lenght2,lenght3; //三角形的各三边长度 int high; //三角形的高 scanf("%d %d %d %d...
用c语言计算两点间的距离 简介 #include <math.h>#include <stdio.h>void main(){float x1, y1, x2, y2;float d;printf("请输入x1,y1,x2,y2,用空格隔开:\n");scanf("%f %f %f %f", &x1, &y1, &x2, &y2);d 正文 1 #include <math.h>#include <stdio.h>void main(){float x1, ...
两点间距离公式c语言c++以下是C++中计算两点间距离的公式: cpp #include <iostream> #include <cmath> using namespace std; int main() { double x1, y1, x2, y2, distance; cout << "Enter coordinates of two points: "; cout << "Point 1(x, y): "; cin >> x1 >> y1; cout << "...
回答:# define struct { double x, y;} point; double distance(point a, b){ return (sqrt( (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) ));}