#include<iostream>
using namespace std;
class student{
public:
student(int num,int sc)
{
number=num;
score=sc;
}
int max(student *s);
//private:
int number;
int score;
};
int max(student *s)
{
int i;int m;
m=s[0].score;
for(i=0;i<6;i++)
if(s[i].score>m)
m=s[i].score;
for(i=0;i<6;i++)
{
if(m==s[i].score)
{
cout<<"学号:"<<s[i].number<<endl;
}
}
return 0;
}
int main()
{
student stu[6]={student(001,70),student(002,77),student(003,99),student(004,88),student(005,90),student(006,80)};
student *s;
s=stu;
int max(student *s);
max(stu);
return 0;
}
作业4.18
最新推荐文章于 2024-04-19 09:01:58 发布