#include <iostream>using namespace std;
//封装一个学生类
struct stu
{
private://存放学生的成绩int stu_score[256];//记录学生个数int stu_num;
public://用于设置学生个数void setNum(){cout<<"请输入学生的个数"<<" ";cin>>stu_num;}//用来对所有学生的成绩进行输入工作void input(){cout<<"请输入成绩:";int i;for(i=0;i<stu_num;i++){cin>>stu_score[i];}}//用来实现对存储的学生成绩进行降序排序void sort(){int i,j;int temp;for(i=1;i<stu_num;i++){for(j=0;j<stu_num-i;j++){if(stu_score[j]<stu_score[j+1]){temp = stu_score[j];stu_score[j] = stu_score[j+1];stu_score[j+1] = temp;}}}}//将所有学生的成绩展示出来void show(){int i;for(i=0;i<stu_num;i++){cout<<stu_score[i]<<" ";}}
};
int main()
{struct stu s1;s1.setNum();s1.input();s1.sort();s1.show();return 0;
}