Make two 2D-points, points in cartesian plane. Calculate the distance between these points.
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);
}
Comments
Leave a comment