#ifndef POINT_H
#define POINT_H
class point
{
public:
point(int x,int y);
int getX();
int getY();
friend float dist(point &p1,point &p2);
private:
int x,y;
};
#endif // POINT_H
#include "point.h"
#include<cmath>
#include<iostream>
point::point(int x,int y):x(x),y(y)
{
}
int point::getX(){return x;}
int point::getY(){return y;}
#include <QCoreApplication>
#include "point.h"
#include<cmath>
#include<iostream>
using namespace std;
float dist(point &p1,point &p2)
{
double x=p1.x-p2.x;
double y=p1.y-p2.y;
return static_cast<float>(sqrt(x*x+y*y));
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
point mp1(1,1),mp2(4,5);
cout<<"The distance is"<<endl;
cout<<dist(mp1,mp2)<<endl;
return 0;
return a.exec();
}