2.cpp

来自「是对类intset的编辑」· C++ 代码 · 共 48 行

CPP
48
字号
#include<iostream>
#include<cmath>
using namespace std;
struct point1
{
 int X;
 int Y;
};
struct point2
{
 float N;
 float M;
};


int main()

{
point1 x,y;
point2 n,m;

int L(point1 x,point1 y );
cout<<"Enter the first  point:";
cin>>x.X>>x.Y;
cout<<"Enter the second  point:";
cin>>y.X>>y.Y;
cout<<"the distance is:"<<L(x,y)<<endl;
float L(point2 n,point2 m );
cout<<"Enter the first  point:";
cin>>n.N>>n.M;
cout<<"Enter the second  point:";
cin>>m.N>>m.M;
cout<<"the distance is:"<<L(n,m)<<endl;

}

int L(point1 x ,point1 y )

{ 
	return (sqrt((x.X-y.X)*(x.X-y.X)+(x.Y-y.Y)*(x.Y-y.Y)));
}
 
float L(point2 n,point2 m )

{ 
	return (sqrt((n.N-m.N)*(n.N-m.N)+(n.M-m.M)*(n.M-m.M)));
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?