C ++ brush question -- 1924: calculate the distance between two points

Source: Internet
Author: User

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 !!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.