#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#define number 5
int main(void)
{
int temp,xh1,xh2,xh3,mp[number];
for(xh1=0;xh1<=number;xh1++)
scanf("%d",&mp[xh1]);
for(xh2=0;xh2<number;xh2++)
{
for(xh1=0;xh1<number-xh2;xh1++)
{
if(mp[xh1]<mp[xh1+1])
{
temp=mp[xh1];
mp[xh1]=mp[xh1+1];
mp[xh1+1]=temp;
}
for(xh3=0;xh3<=number;xh3++)
printf("%d ",mp[xh3]);
printf("\n");
}
}
for(xh1=0;xh1<=number;xh1++)
printf("%d ",mp[xh1]);
printf("\n");
system("pause");
return 0;
}
【C入门向】冒泡排序详解
最新推荐文章于 2021-05-18 23:05:14 发布