#include
int main()
{int n,i,j,t,a[20];
scanf("%d",&n);
for(i=0;i scanf("%d",&a[i]); for(i=0;i {for(j=0;j if(a[j]>a[j+1]) {t=a[j];a[j]=a[j+1];a[j+1]=t;} for(j=0;j printf("%d,",a[j]); printf("%d\n",a[j]); } return 0; }
#include "stdafx.h"
#include
#include
using namespace std;
void sort(int arry[],int counts)//冒泡排序法
{
for(int i=0;i
for(int j=0;j
if(arry[j]>arry[j+1])//比较大小
{
int temp;
temp=arry[j];
arry[j]=arry[j+1];
arry[j+1]=temp;
}
}
for (int k=0;k
cout<
cout<<'\n';
}
}
int main()
{
int arry[10];
char c;
int counts=0;
while((c=getchar())!='\n')//获取一行输入
{
if(c>='0'&&c<='9')
{
ungetc(c,stdin);//将获取的字符返回流
cin>>arry[counts++];
}
}
sort(arry,counts);
system("pause");
return 0;
}