You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
475 B
22 lines
475 B
#include<iostream>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int a[10],i,j,t;
|
|
for(i=0; i<=10; i++){
|
|
a[i]=0; //初始化数组的每一项都为0
|
|
}
|
|
|
|
for(i=1; i<=5; i++){
|
|
cin>>t; //循环输入5个字
|
|
a[t]++; //对应下标的数组值+1
|
|
}
|
|
|
|
for(i=0; i<=10; i++){ //遍历数组,从小到大排序
|
|
for(j=1; j<=a[i]; j++){ //确定每一项的值,出现几次就打印几次
|
|
cout<<i<<" ";
|
|
}
|
|
}
|
|
return 0;
|
|
}
|