level 1
恩惠是啥
楼主
在主函数中,先定义一个学生类对象数组,再通过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);
};
怎么给对象数组赋值呢
2015年11月27日 14点11分
1
};
怎么给对象数组赋值呢






