首页 > C++的开发问题

C++的开发问题

include

using namespace std;
struct Node
{
int x;
int y;

};
int main()
{
Node a;
Node *b;
a.x=5;
a.y=6;
cout<<a.x<<endl;
cout<<a.y<<endl;
cout<x<<endl;//后面两个是箭头,由点改为箭头,不知道为啥显示不出来。
cout<y<<endl;//
return 0;
}
结果前两个是5 6
我就想问后两个很长的数字是什么?求解。。谢谢。。


你应该是打错了。
很长的数字可能是指针的值。


其实不太懂你的问题表述...
你想得到的是不是这个?

#include <iostream>
using namespace std;
struct Node
{
int x;
int y;

};
int main()
{
Node a;
Node *b;
a.x=5;
a.y=6;
b=&a;
cout<<a.x<<endl;
cout<<a.y<<endl;
cout<<b->x<<endl;
cout<<b->y<<endl;
return 0;
}

运行输出:

5
6
5
6
【热门文章】
【热门文章】