//* double data types and operations, performing some math calculations *

#include <iostream> #include <cmath> using namespace std; int main() { double x1, y1, x2, y2; cout << "Please enter the coordinates of the first point x1 and y1 "; cin >> x1 >> y1; cout << "Please enter the coordinates of the second point x2 and y2 "; cin >> x2 >> y2; double dx=x2-x1; double dy=y2-y1; double distance=sqrt(dx*dx+dy*dy); /* // coding as shown in the line below is very inefficient double distance=sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ); */ cout << "The distance between the two pints is " << distance << endl; return(0); }