不存在从“”到“*”的适当转换函数
#include<iostream>
using namespace std;
#include<string>
struct student {
string name;
int score;
};
struct teacher {
string name;
struct student stu[5];
};
void swaper(teacher tea[], int len) {
string name[] = { "wang","li","zhao","xiaowang","xiaoli","xiaoming","xiaozhang","xiaogou" };
for (int i = 0; i < len; i++) {
tea[i].name = name[i];
cout << "teacher's name:" << tea[i].name << endl;
for (int j = 0; j < 5; j++) {
tea[i].stu[j].name = name[j + 3];
tea[i].stu[j].score = rand() % 61 + 40;
cout << "student'name:" << tea[i].stu[j].name << "student'score:" << tea[i].stu[j].score << endl;
}
}
}
int main() {
teacher tea[3];
int len=sizeof(tea)/sizeof(tea[0]);
swaper(tea[3], len);
}