Write, compile and execute a C++ program that calculates the distance between two points whose coordinates are (7, 12) and (3, 9). Use the fact that the distance between two points having coordinates (x1, y1) and (x2, y2) is distance = sqrt ([x1 - x2]2 + [y1 - y2]2). When you have verified that your program works correctly, by calculating the distance between the two points manually, use your program to determine the distance between the points (-12, -15) and (22, 5).
int main() { cout << "The distance between points (7, 12) and (3, 9) is: " << distance(7, 12, 3, 9) << endl; cout << "The distance between points (-12, -15) and (22, 5) is: " << distance(-12, -15, 22, 5) << endl;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment