#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
struct student
{
string name;
double midterm;
double final;
vector<double> homework;
};
void main()
{
vector<student> vec;
student stu1;
stu1.name = "aaa";
stu1.midterm = 1.12;
stu1.final = 3.33;
stu1.homework.push_back((double)3.3);
stu1.homework.push_back((double)3.5);
stu1.homework.push_back((double)3.4);
//将stu1加入vector
vec.push_back(stu1);
student stu2;
stu2.name = "bbb";
stu2.midterm = 5.62;
stu2.final = 9.63;
stu2.homework.push_back((double)4.9);
stu2.homework.push_back((double)5.3);
//将stu1加入vector
vec.push_back(stu2);
//输出
vector<student>::iterator it = vec.begin();
for (; it != vec.end(); ++it)
{
cout << it->name<< " " << it->midterm << " " << it->final << endl;
vector<double>::iterator itD = it->homework.begin();
for (; itD != it->homework.end(); ++itD)
{
cout << *itD << " ";
}
cout << endl << "====================================================" << endl;
}
}