有誰知道問題是什么,求大神
#include<iostream>
#include<stdlib.h>
using namespace std;
class coord
{
public:
?? ?int x;
?? ?int y;
?? ?void printf_X()
?? ?{
?? ??? ?cout << x << endl;
?? ?}
?? ?void printf_Y()
?? ?{
?? ??? ?cout << y << endl;
?? ?}
};
int main()
{
?? ?coord cc;
?? ?cc.x = 7;
?? ?cc.y = 9;
?? ?cc.printf_X();
?? ?cc.printf_Y();
?? ?coord *p = new coord();
?? ?if (NULL = p)
?? ?{
?? ??? ?system("pause");
?? ??? ??? ?return 0;
?? ?}
?? ?p->x = 100;
?? ?p->y = 200;
?? ?p->printf_X();
?? ?p->printf_Y();
?? ?delete p;
?? ?p = NULL;
?? ?
?? ?system("pause");
?? ?return 0;
}
2016-07-30
NULL = p應該為p==NULL
2016-07-30
判斷等號