//R[0]是交换的元素
//完整程序
#include
#include
#define MAX 10
int main()
{
int i,j,t,a[MAX],flag;
printf("Please input MAX integers:\n");
for(i=0;i scanf("%d",&a[i]);
for(i=0;i {
flag=0;
for(j=0;j if(a[j]>a[j+1])
{
t=a[j]; /* 交换a[i]和a[j] */
a[j]=a[j+1];
a[j+1]=t;
flag=1;
}
if(flag==0)break;
}
printf("The sequence after sort is:\n");
for(i=0;i printf("%-5d",a[i]);
printf("\n");
system("pause");
return 0;
}
阅读(873) | 评论(0) | 转发(1) |