giúp mình với! code này run được nhưng báo lỗi trong khi nhập x, y. Mình nghĩ lỗi ở đâu đó, nhưng mình ko sửa được…![]()
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class Toado2D
{
private:
int x;
int y;
Toado2D *next;
public:
Toado2D()
{
x = 0;
y = 0;
}
Toado2D(int x, int y)
{
this->x = x;
this->y = y;
}
Toado2D operator<=(Toado2D M);
Toado2D operator=(Toado2D M);
Toado2D operator>(Toado2D M);
friend istream &operator>>(istream &s, Toado2D *M);
friend ostream &operator<<(ostream &s, Toado2D *M);
};
istream &operator>>(istream &s, Toado2D *M)
{
cout<<"Nhap toa do (x, y): ";
s>>M->x>>M->y;
return s;
}
/* ostream &operator<<(ostream &s, Toado2D *M)
{
cout<<"Toa do da nhap
";
s<<"("<<M.x<<","<<M.y<<")"<<endl;
return s;
} */
main()
{
Toado2D *A;
cin>>A;
getch();
}