结构体的声明
//定义结构体 Point struct Point { int x; int y; }; void main() { Point pt; pt.x=5; pt.y=7; cout<<pt.x<<endl<<pt.y<<endl; } //-------------------------------------------------------------------- //定义结构体 Point struct Point { int x; int y; void output() { cout<<x<<endl<<y<<endl; } }; void main() { Point pt; pt.output(); //C++中允许结构体中包含函数,C语言中不可以 }
posted on 2015-06-08 22:19 Rohalloway 阅读(187) 评论(0) 编辑 收藏 举报