#include<iostream>
using namespace std;
struct student
{
string name;
int age;
int score;
};
void print1(student s)
{
cout << "姓名:" << s.name << " " << "年龄:" << s.age << " " << "分数:" << s.score << endl;
}
void print2(student* s)
{
cout << "姓名:" << s->name << " " << "年龄:" << s- >age << " " << "分数:" << s->score << endl;
}
int main()
{
student s = {"xiansifan",22,90 };
cout << s.name << " " << s.age << " " << s.score << endl;
//print1(s);
print2(&s);
system("pause");
return 0;
}
网友评论