struct Stu
{
private:
int arr[520];
private:
int count;
public:
void setNum(int num)
{
count = num;
return;
}
public:
void input()
{
cout<<"请输入学生的成绩"<<endl;
int i = 0;
for(i = 0; i < count; i++)
{
cin>>arr[i];
}
}
public:
void sort()
{
int i = 0;
int j = 0;
int temp = 0;
for(i = 0; i < count - 1; i++)
{
for(j = i; j < count - i; j++)
{
if(arr[j+1] > arr[j])
{
temp = arr[j+1];
arr[j+1] = arr[j];
arr[j] = temp;
}
}
}
cout<<"排序成功"<<endl;
}
public:
void show()
{
int i = 0;
for(i = 0; i < count; i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
}
};
void setNum(int num);
void input();
void sort();
void show();
int main()
{
Stu s;
s.setNum(5);
s.input();
s.sort();
s.show();
return 0;
}