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?