建立一个对象数组,内放5个学生的(学号,成绩),设立一个函数max,用指向对象的指针作函数参数,在max函数中找出5个学生的最高成绩者,并输出其学号。
#includeusing namespace std; class Student {public: Student(int=10,int=0); int number; int score; void display(); }; Student::Student(int num,int sco):number(num),score(sco){ } void Student::display() { cout< maxi) { maxi=p[i].score; temp=i; } cout<
以上这篇C++之类和对象课后习题简单实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持考高分网。



