提供一个冒泡排序法,已通过编译,仅供参考~
#include
#include
main()
{
int a[100],n,i,j,temp;
printf("Input number of integers\n");
scanf("%d",&n);
printf("Input integers in order\n");
for(i=0;i
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=n-1;i>=0;i--)
{
printf("%d",a[i]);
printf(" ");
}
printf("\n");
}
呃