Answer to Question #174664 in C++ for zain ul abdeen

Question #174664

Make two 2D-points, points in cartesian plane. Calculate the distance between these points.


1
Expert's answer
2021-03-23T03:40:23-0400
using namespace std;


// Make two 2D-points, points in cartesian plane. 
// Calculate the distance between these points.
main(void)
{
	float x1=2,y1=3,x2=6,y2=9;
	float Dist;
	
	Dist = sqrt(pow(x1-x2,2) + pow(y1-y2,2));
	cout<<"\nPoint-1: ("<<x1<<", "<<y1<<")";
	cout<<"\nPoint-2: ("<<x2<<", "<<y2<<")";
	cout<<"\n\nDistance between the points: "<<Dist;
	return(0);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS