Week 8 computer task-distance between two points

Source: Internet
Author: User

Objective: To be proficient in C ++ programming

Computer task: DesignProgramCalculate the two-point distance

/** Copyright (c) 2011, School of Computer Science, Yantai University * All Rights Reserved. * Author: Qiu xuewei * Completion Date: July 15, October 20, 2012 * version No.: V1.0 ** input Description: two points distance * Problem description: enter coordinates of two points, calculate the distance between two points and output * program output: two points distance * Problem Analysis: omitted *AlgorithmDESIGN: slightly */# include <cmath> // There is no way to calculate the formula without this program # include <iostream> using namespace STD; int main () {double X1, Y1, x2, Y2, D; cout <", enter the coordinate value of the first vertex:"; CIN> x1> Y1; cout <"coordinates of the second point:"; CIN> X2> Y2; D = SQRT (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2); cout <"two points distance:" <D <Endl; return 0 ;}

Experience: Better than the last time, a small victory

 

 

 

 

 

Running result:

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.