(C++)Calculating distance between 2 points. Get from the user the x and y coordi
ID: 3782011 • Letter: #
Question
(C++)Calculating distance between 2 points.
Get from the user the x and y coordinates (doubles) of 2 points and then calculate the distance between these points using the Pythagorean theorem. First, get from the user the x and y coordinate values for the first point second, get from the user the x and y coordinate values for the second point. Finally, calculate and output the distance between these 2 points, using the Pythagorean theorem. Recall, the Pythagorean theorem tells us you can calculate the floating-point distance between two points (x1, y1) & (x2, y2) by calculating the squareroot of (x2 - x1) squared plus (y2 - y1) squared. Instructions Deliverables main Cpp We will expect the above file(s) to be submitted Compile command g++ main-cpp-Wall -Werror-O a .out We will use this command to compile your codeExplanation / Answer
#include #include using namespace std; int ch; double x; double y; double a; double b; double answer; double distance(double x, double y, double a, double b); int main(){ coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.