1924: Calculate the distance between two points
Description
Enter two point coordinates (X1,Y1), (X2,y2), and calculate and output the distance between two points.
Input
The input data has more than one group, each group occupies a row, consisting of 4 real numbers, representing X1,y1,x2,y2, separated by a space between the data.
Output
For each set of input data, the output is one line and the result retains two decimal places.
/* Copyright (c) 2014, Yantai University School of Computer * All rights reserved. * File name: Test.cpp * Chen Dani * Completion date: May 20, 2015 * Version number: v1.0 * * #include <iostream> #include <iomanip> #include <c Math>using namespace Std;int Main () { int a,b,c,d; double S; while (cin>>a>>b>>c>>d) { s=sqrt ((a-c) * (a-c) + (b-d) * (b-d)); Cout<<setiosflags (ios::fixed) <<setprecision (2) <<s<<endl; } return 0;}
Experience: By doing problems can increase self-confidence, but also to improve their skills, refueling!!
C + + brush question--1924: Calculate the distance between two points