//#include<iostream>
//using namespace std;
//#include<string>
//
//struct student
//{
// string sname;
// int score;
//};
//
//
//struct teacher
//{
// string tname;
// struct student sarray[5];
//};
//
//void allocatespace(struct teacher tarray[],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[j].sname = "student_";
// tarray[i].sarray[j].sname += nameseed[j];
//
// tarray[i].sarray[j].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()
//{
// struct teacher tarray[3];
// int len=sizeof(tarray)/sizeof(tarray[0]);
// allocatespace(tarray,len);
// printinfo(tarray,len);
// system("pause");
// return 0;
//}
#include<iostream>
using namespace std;
#include<string>
struct student//学生
{
string sname;
int scroe;
};
struct teacher //老师
{
string tname;
struct student sarray[5];
};
void allocatespace(struct teacher tarray[], int len) //赋值
{
string nameseed = "ABDCE";
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[j].sname = "student_";
tarray[i].sarray[j].sname += nameseed[j];
tarray[i].sarray[j].scroe = 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; i++)
{
cout << "学生的姓名: " << tarray[i].sarray[j].sname
<< " 考试分数" << tarray[i].sarray[j].scroe << endl;
}
}
}
int main()
{
struct teacher tarray[3];
int len = sizeof(tarray) / sizeof(tarray[0]);
allocatespace(tarray, len);
printinfo(tarray, len);
system("pasue");
return 0;
}