巩固学习,写着玩。
#include#include using namespace std; //粉丝的结构体 struct fan { string name; }; //结构体指针 struct beauty { string name; int age; int stature; struct fan f;//粉丝的结构体 }; int main() { //创建美男结构体变量 struct beauty s; s.name = "龚俊"; s.age = 31; s.stature = 186; s.f.name = "蘑菇"; //通过指针指向结构体变量 struct beauty * p = &s;//struct关键字可以省略 //通过指针访问结构体数据 //通过指针访问结构体变量利用箭头来访问 cout << "姓名" << p->name << endl; cout << "年龄" << p->age << endl; cout << "身高" << p->stature << endl; cout << "粉丝的名字" << p->f.name<



