⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2.cpp

📁 是对类intset的编辑
💻 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 + -