用冒泡法对一个数据进行排序
想知道为什么下面的代码输入会出问题?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main()
{
int a[10],b[10],i,t,k;
for(i=0;1<10;i++)
scanf("%d",&a[i]);
for(k=0;k<10;k++)
{
for(i=0;i<9-k;i++)
{
if (a[i]>a[i+1])
{
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
}
}
}
for(i=0;i<10;i++)
printf("%d",a[i]);
return 0;
}