实例:老师辅导学生
 
#include <iostream>
using namespace std;
#include<string>
/*
	定义学生和老师两个结构体
*/
struct Student
{
	string name;
	int age;
	int score;
};
struct Teacher
{
	int id;
	string name;
	int age;
	struct Student s1;
};
int main() 
{
	struct Teacher t1;//创建老师结构体变量
	
	t1.id = 1;
	t1.name = "李老师";
	t1.age = 48;
	t1.s1.name = "小红";
	t1.s1.age = 19;
	t1.s1.score = 59;
	cout <<"老师姓名:" <<t1.name<<"  "<< "老师辅导的学生姓名:"<<t1.s1.name << endl;
	system("pause");
	return 0;
}