// Sample program from text. v. 10/23/02 // from pg. 17. // // Program computes the distance between two points. #include #include #include int main() { // Define and initialize variables. double x1=1, y1=5, x2=4, y2=7, side_1, side_2, distance; // Compute length of sides of right triangle. side_1 = x2 - x1; side_2 = y2 - y1; distance = sqrt( side_1*side_1 + side_2*side_2 ); // Print distance. cout << "The distance between the two points is << distance << " cm." << endl; return 0; }