#include<iostream>
#include<string>
using namespace std;
//定义结构体
struct Student {
string name;
int age;
int score;
};
int main() {
Student s1;
//结构体使用
s1.name = "张三";
s1.age = 21;
s1.score = 60;
cout << "姓名:" << s1.name << endl
<< "年龄:" << s1.age << endl
<< "分数:" << s1.score << endl;
system("pause");
return 0;
}
结构体定义和使用
最新推荐文章于 2024-09-15 11:40:06 发布