错误显示'des' : undeclared identifier,错哪了?
#ifndef POINT_H_#define POINT_H_
using namespace std;
class Point
{
private:
int x;
int y;
public:
Point(int x=0,int y=0): x(x),y(y)
{
cout<<"."<<endl;
}
void in();
void out();
double des(Point,Point);
};
#endif
#include<iostream>
#include<math.h>
#include"point.h"
int main()
{
Point p1,p2;
p2.in();
p1.out();
p2.out();
cout<<des(p1,p2);
return 0;
}
void Point::in ()
{
cin>>x>>y;
}
void Point::out()
{
cout<<"("<<x<<","<<y<<")"<<endl;
}
double Point::des(Point p1,Point p2)
{
int a=0;
a=sqrt(pow(p1.x-p2.x,2)+pow(p1.y-p2.y,2));
return a;
}