0
点赞
收藏
分享

微信扫一扫

C++ 结构体

天蓝Sea 2022-01-26 阅读 162


C++ 结构体_#include

#include <iostream>

struct student {
int a;
int b;
int add(){ //在结构体内封装了函数
return a+b;
}
};

int main(){

student s={10,20};
  //c++时struct 可以省略
int x=s.add(); printf("%d\n",x); }


举报

相关推荐

0 条评论