If I refect the line of number 18, 44, the code'll run good. I try to think but I haven't found the false!! You concertrate to line (18, 44). Please check it for me! thank you very much...
You're not foreign, doofus. We're the same nationality as you.
We didn't answer because your code is using non-standard C++ from 15 years ago which has been simply wrong since 1998, and because you didn't ask a question. What does your code do that you think it shouldn't do?
"What does your code do that you think it shouldn't do?"
I'm vietnamese.
I would ask that why this code appeared a false at line of 18 and 44. Which method can fix it? thank you..
I don't understand what you mean. The following code is your code converted to C++. It compiles without error. You might need to get a C++ compiler in order to compile it.
#include<iostream>
#include<iomanip>
usingnamespace std;
class Toado2D
{
private:
int x;
int y;
Toado2D *next;
public:
Toado2D()
{
x = 0;
y = 0;
next = NULL;
}
void Laynext(Toado2D *M);
intoperator<=(Toado2D *M);
intoperator=(Toado2D *M);
intoperator>(Toado2D *M);
friend istream &operator>>(istream &s, Toado2D *M);
friend ostream &operator<<(ostream &s, Toado2D *M);
};
Toado2D *first, *last, *p;
void Toado2D::Laynext(Toado2D *M)
{
this->next = p;
}
void NhapToaDo()
{
char c;
do
{
p = new Toado2D;
cin>>p;
if(first = NULL)
{
first = p;
last = p;
}
else
{
last->Laynext(p);
last = p;
}
cout<<"Ban co muon nhap tiep khong? (c/k)";
cin >> c;
}while(c!='k');
}
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 \n";
s<<"("<<M->x<<","<<M->y<<")"<<endl;
return s;
}
int Toado2D::operator<=(Toado2D *M)
{
if(this->x <= M->x && this->y <= M->y)
return 1;
elsereturn 0;
}
/*int Toado2D::operator=(Toado2D *M)
{
if(this->x = M->x && this->y = M->y)
return 1;
else
return 0;
} */
int Toado2D::operator>(Toado2D *M)
{
if(this->x > M->x && this->y > M->y)
return 1;
elsereturn 0;
}
main()
{
first = NULL;
last = NULL;
NhapToaDo();
}
If you need to get a modern compiler, here are some options:
This is the option I recommend, considering the formidable alternatives. I did not include options that I am certain are only for platforms other than Windows (XCode 4).
The list of good free IDEs includes but is not limited to:
Eclipse has a little bit of a learning curve, just as a warning.
Make the change to wxDev-C++
This is the recommended option if you really like Dev-C++ or if a professor, boss, or team requires you to continue to use Dev-C++ or a derivative. wxDev-C++ is being updated, it's a bit more modern, it features a designer for wxWidgets should you want to create GUI applications, and finally as the name implies it is based on the original.