#include<iostream>
using namespace std;
#include<string>
//结构体指针
//定义学生结构体
struct student
{
string name;
int age;
int score;
};
int main(){
//1,创建学生结构体变量
struct student s1;//struct可以省
s1.name="张三";
s1.age=19;
s1.score=77;
//2,通过指针指向结构体变量
struct student *p=&s1;//struct可以省
//3.通过指针访问结构体变量中的数据
//访问结构体变量中的属性,用->
cout<<"姓名: "<<p->name<<"年龄: "<<p->age<<"分数: "<<p->score<<endl;
system("pause");
return 0;
}