
#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); }C++ 结构体
阅读 168
2022-01-26

#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)