#include <iostream>
using namespace std;
struct stu
{
int age; //定义年龄
string sex; //定义性别
void func();
void set_name(string &str,float &s) //共有函数
{
name = str;
score = s;
}
private: //私有权限
string name;
float score; //定义分数
};
void stu::func()
{
cout << name << endl;
cout << age << endl;
cout << sex << endl;
cout << score << endl;
}
int main()
{
stu students;
string str = "瑶";
students.age = 17;
students.sex = "女";
float s = 99;
students.set_name(str,s);
students.func();
return 0;
}