1815. 计算两点间的距离(类实现)
来源:互联网 发布:烂番茄新鲜度100 知乎 编辑:程序博客网 时间:2024/05/08 12:03
Sicily 1815. 计算两点间的距离
Description
请用类描述顶点信息,输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。
Input
输入数据第一行一个整数 n,代表测试数据组数,接下来 n 行,每行由 4 个实数组成,分别表示 x1,y1,x2,y2,数据之间用空格隔开。
Output
对于每组测试数据,输出一行,结果保留两位小数。
Sample Input
20 0 0 10 1 1 0
Sample Output
1.001.41
1 #include <iostream> 2 #include <iomanip> 3 #include <cmath> 4 using namespace std; 5 6 class point 7 { 8 public: 9 void getpoint()10 {11 cin >> x >> y;12 }13 void showpoint(point & point1)14 {15 cout << fixed << setprecision(2) << sqrt(pow(fabs(x - point1.x), 2) + pow(fabs(y - point1.y), 2));16 }17 private:18 double x,y;19 };20 int main()21 {22 int n;23 cin >> n;24 int i;25 point point1, point2;26 for (i = 0; i < n; i++)27 {28 point1.getpoint();29 point2.getpoint();30 point1.showpoint(point2);31 cout << endl;32 }33 return 0;34 }
- 1815. 计算两点间的距离(类实现)
- 1815. 计算两点间的距离
- sicily--1815. 计算两点间的距离
- 1815. 计算两点间的距离 easy
- Sicily 1815. 计算两点间的距离
- 1815. 计算两点间的距离
- hdu0j2001(计算两点间的距离)
- 计算两点间的距离(2001)
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- 计算两点间的距离
- Java序列化 如何把多个对象存储在一个文件中
- eFuse
- Android Application Task Activities的关系
- floor函数 ceil函数 意义
- OpenStack Nova 制作 Ubuntu 镜像
- 1815. 计算两点间的距离(类实现)
- 分治法学习
- YII Framework学习教程-YII的Model-开发规范-路径别名-命名空间-2011-11-22
- dynamically changing delay in gr_delay (or history in any gr_block)
- Zend Studio 9.0正式版注册破解
- rpmbuild 中文man页面
- JAVA WEB_JSP的初步(12)
- 一个在linux下的键盘字符识别程序
- SQL Server 2008 R2修复