📄 2.cpp
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -