首页 > 其他 > 详细

结构体的声明

时间:2015-06-08 23:05:40      阅读:185      评论:0      收藏:0      [点我收藏+]
//定义结构体 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语言中不可以
}

 

结构体的声明

原文:http://www.cnblogs.com/ROHALLOWAY/p/4562114.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!