#include<iostream>
using namespace std;
class student{
public:
student(int num,float sc)
{
number=num;
score=sc;
}
void display()
{
cout<<"学号:"<<number<<' ';
cout<<"成绩:"<<score<<' ';
cout<<endl;
}
private:
int number;
float score;
};
int main()
{
student stu[6]={student(001,70),student(002,77),student(003,80),student(004,88),student(005,90),student(006,99)};
student *s=stu;
(s+1)->display();
(s+3)->display();
(s+5)->display();
return 0;
}
作业4.17
最新推荐文章于 2022-10-14 21:13:18 发布