满意答案
jdxc
2013.11.18
采纳率:56% 等级:12
已帮助:4206人
#include
class student
{
public:
void setscore(int en,int co)
{
english=en;
computer=co;
}
int getscore()
{
total=english+computer;
return total;
};
void display(int i)
{
cout<
cout<
cout<
}
private:
int english,computer,total;
};
void main()
{
int i,total[3],english,computer,temp;
student stu[3];
cout<
for(i=0;i<3;i++)
{
cin>>english>>computer;
stu[i].setscore(english,computer);
}
for(i=0;i<3;i++)
{
stu[i].display(i);
total[i]=stu[i].getscore();
}
if(total[0]
{
temp=total[0];
total[0]=total[1];
total[1]=temp;
}
if(total[0]
{
temp=total[0];
total[0]=total[2];
total[2]=temp;
}
if(total[1]
{
temp=total[1];
total[1]=total[2];
total[2]=temp;
}
for(i=0;i<3;i++)
cout<
cout<
}
00分享举报