소스
--------------------------------------------------------------------------------
#include <iostream.h>
#include <math.h>
class point {
int x1, y1;
public:
point(int a, int b);
int set_point(int x2, int y2);
double GetDistance(int x, int y);
};
point::point(int a, int b)
{
x1 = a;
y1 = b;
}
double GetDistance(int x, int y)
{
return sqrt((x2-x1) * (x2-x1) + (y2-y1) * (y2-y1));
}
int set_point(int x2, int y2)
{
cout << "Enter a X2 :";
cin >> x2;
cout << "n";
cout << "Enter a Y2 :";
cin >> y2;
cout << "n";
return 1;
}
---------------------------------------------------------------------------------
에러메시지
C:C++1.cpp(20) : error C2065: 'x2' : undeclared identifier
C:C++1.cpp(20) : error C2065: 'x1' : undeclared identifier
C:C++1.cpp(20) : error C2065: 'y2' : undeclared identifier
C:C++1.cpp(20) : error C2113: pointer can only be subtracted from another pointer
C:C++1.cpp(20) : error C2113: pointer can only be subtracted from another pointer
뭐가 문젠지 모르겠네요 ㅇㅅㅇ;;
그냥 지나가던 뉴비입니다
훼인 아니에요 '-'
int point::set_point( int x2, int y2 )