Week 8 Computer Task 3-finding the distance between two points

Source: Internet
Author: User
01. /* 02. * copyright (c) 2012, School of Computer Science, Yantai University 03. * All Rights Reserved. 04. * Author: Zhao guanzhe 05. * Completion Date: July 6, October 18, 2012. * version No.: V1.0 07.*08. * input Description: none. * Problem description: the distance between two points is 10. *ProgramOutput: distance between two points 11. * Problem Analysis: 12 .*AlgorithmDESIGN: omitted 13. */# include <cmath> # include <iostream> using namespace STD; int main () {Long Double A, B, C, D, E, F, G; cout <"Enter the coordinates of two points in sequence:"; CIN> A> B> C> D; E = D-B; F = C-; G = SQRT (E * E + F * F); cout <"distance between two points =" <G <Endl; return 0 ;}

Running result:

Experience:

It is too complicated to compile this program under the course. It involves many things. But the teacher often told me that programming is easier and easier. Simple and seemingly complex problems are essential skills.

Knowledge Point summary:

I learned to call the SQRT function. I am thinking, if the SQRT function is a negative value, do I need to adjust it to a positive value?

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.