求教一下c++关于对象数组的问题
在主函数中,先定义一个学生类对象数组,再通过for循环给对象数组赋上实际值,最后输出对象数组个元素的值 class Score
{
protected:
double Chinese,English,Mathematics;
public:
Score():Chinese(0),English(0),Mathematics(0){}
Score(int Chinese, int English, int Mathematics):Chinese(Chinese),English(English),Mathematics(Mathematics){}
double sum(); //计算三门课总成绩
void print(); //输出三门课成绩和总成绩
void modify(int Chinese, int English, int Mathematics); //修改三门课成绩
};
class Student
{
protected:
string Num, Name;
Score MyScore;//学生类中包含Score类的对象,体现了组合,让学生重点掌握
public:
Student():Num(""),Name(""),MyScore(){}
Student(string num, string name, Score score):Num(num),Name(name),MyScore(score){}
double sum(); //计算三门课总成绩
void print();
void modify(string num, string name, Score score);
};
怎么从键盘上输入学号和成绩呢