结构体学习

来源:互联网 发布:淘宝店铺模板制作 编辑:程序博客网 时间:2024/06/14 02:40
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;struct node {    int x, y;    node () {};    node (int x, int y) :       x(x), y(y) {};};int main() {    node a;    node b(1, 2);    node c = node(1, 2);    printf("a = %d %d\n", a.x, a.y);    printf("b = %d %d\n", b.x, b.y);    printf("c = %d %d\n", c.x, c.y);    return 0;}



#include <cstdio>#include <cstring>#include <algorithm>using namespace std;struct node {    int x, y;    //node () {};    node (int x = 0, int y = 0) :       x(x), y(y) {};};int main() {    node a;    node b(1, 2);    node c = node(1, 2);    printf("a = %d %d\n", a.x, a.y);    printf("b = %d %d\n", b.x, b.y);    printf("c = %d %d\n", c.x, c.y);    return 0;}


留个底, 防止忘记

0 0
原创粉丝点击