结构体定义

#include<iostream>
using namespace std;

//定义结构体 
struct point
{
    int x;
    int y;
    void output()
    {
        cout << x << endl << y << endl;
    }
};
int main()
{
    point pt;
    pt.x = 10;
    pt.y = 20;
    pt.output();
    return 0;

}

 

posted @ 2021-01-31 21:20  梦之心  阅读(37)  评论(0编辑  收藏  举报