```c++
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <ctime>
using namespace std;
//学生数组
struct Students
{
//姓名
string sName;
//分数
int score;
};
//老师数组
struct Teacher
{
//姓名
string tName;
//学生数组
struct Students sArray[5];
};
//创建一个给老师和学生赋值的函数
void allocateSpace(struct Teacher tArray[3], int len)
{
string nameseed = "ABCDE";
//给老师开始赋值
for (int i = 0; i <= len; ++i)
{
tArray[i].tName = "Teacher_";
tArray[i].tName += nameseed[i];
//给老师带的学生赋值
for (int j = 0; j <= 5; ++j) {
tArray[i].sArray[i].sName = "Students_";
tArray[i].sArray[i].sName += nameseed[i];
tArray[i].sArray[i].score = 60;
}
}
}
//打印所有信息
void printinfo(struct Teacher tArray[], int len)
{
for (int i = 0; i <= len; ++i)
{
cout << "老师的姓名:" << tArray[i].tName << endl;
for (int j = 0; j <= 5; ++j)
{
cout << "学生的姓名:" << tArray[i].sArray[j].sName <<
"考试分数:" << tArray[i].sArray[j].score << endl;
}
}
}
int main(void)
{
//创建三名老师的数组
struct Teacher tArray[3];
//通过函数给三名老师赋值,并且给三名老师所带的五名学生的信息赋值
int len = sizeof(tArray) / sizeof(tArray[0]);
allocateSpace(tArray, len);
//打印
printinfo(tArray, len);
system("pause");
}
```