#include<iostream>
using namespace std;
class student{
public:
student(int a,int b)
{
number=a;
performance=b;
}
void display();
private:
int number;
int performance;
};
void student::display()
{ cout<<"该学生的学号:"<<number<<endl;
cout<<"该学生的成绩:"<<performance<<endl<<endl;
}
int main()
{
student *p;
student stu[6]={
student(01,99),
student(02,50),
student(03,60),
student(04,77),
student(05,33),
student(06,88)
};
p=stu;
p=p++;
for(int i=0;i<3;i++)
{
p->display();
p+=2;
};
return 0;
}
4.17
最新推荐文章于 2024-05-27 00:11:36 发布