发布网友 发布时间:2022-04-22 21:27
共1个回答
热心网友 时间:2022-06-18 19:59
#include<iostream>
using namespace std;
class Student
{
public:
Student(float ag);
friend void ave(Student s1,Student s2);
private:
float averGrade;
};
Student::Student(float ag):averGrade(ag)
{
}
void ave(Student s1,Student s2)
{
cout<<"学生s1和学生s2的平均学分绩是:"<<(s1.averGrade+s2.averGrade)/2<<endl;
}
int main()
{
Student s1(7.1),s2(9.3);
ave(s1,s2);
}