Professional Documents
Culture Documents
Question:
Write a function to compute distance between two point objects.
#include <iostream>
#include <math.h>
using namespace std;
class Point
{
public:
int x;
int y;
double distance(Point &temp);
};
int main ( )
{
Point p1, p2;
p1.x=0;
p1.y=0;
p2.x=5;
p2.y=5;
cout<<"The distance is: "<<p1.distance(p2)<<endl;
cout<<pow(4,0.5);
return 0;
}