建立一个对象数组,内放5个学生的数据(学号、成绩),设立一个函数max,用 指向对象的指针作函数参数,在max函数中找出5个学生中成绩最高者,并输出其学号。初值自拟
#include #include class student { private: std::string sno; int score; public: /*student( { }*/
friend void max(student *p; student(std::string a, int b { sno = a; score = b; } student(int b :score(b { } void display( { std::cout << sno << "
" << score << std::endl; }
本文来源:https://www.2haoxitong.net/k/doc/106307a880eb6294dd886ce9.html