C ++ brush question -- 1924: calculate the distance between two points
1924: calculate the distance between two points
Description
Input two-point coordinates (X1, Y1), (X2, Y2), calculate and output the distance between two points.
Input
There are multiple groups of input data. Each group occupies one row and consists of four real numbers, representing x1, y1, x2, and y2 respectively. Data is separated by spaces.
Output
For each group of input data, a row is output, and the result is retained with two decimal places.
/* Copyright (c) 2014, School of Computer Science, Yantai University * All rights reserved. * file name: test. cpp * Prepared by: Chen Danni * completion date: May 20, 2015 * version No.: v1.0 */# include
# Include
# Include
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 <
Experience: By doing questions, you can increase confidence and improve your skills. Come on !!