int _tmain(int argc, _TCHAR* argv[])
{
int a[100];
int n;
int i=0;
int j=0;
int temp;
printf("输入数字个数\n");
scanf("%d",&n);
printf("要排序的数\n");
for(i=0;i{
scanf("%d",&a[i]);
}
for(i=0;i{
for(j=i+1;j{
if(a[j] {
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("排序后的数列为\n");
for(i=0;i{
printf("%5d",a[i]);
}
return 0;
}
这才是冒泡法,你那不知道是什么法
排序有问题, 会抓到後面无资料的地方... 所以你资料中有多一个0.