标签:style color io strong for sp on c r
#include <stdio.h>
int main(void){
int a,b,c,d;
int maopao[15]={6,5,7,8,4,9,3,1,2,15,13,11,12,10,14};
for (a=13; a>=0; a--) {
for (b=0; b<=a; b++) {
if (maopao[b]>maopao[b+1]) {
c=maopao[b];
maopao[b]=maopao[b+1];
maopao[b+1]=c;
}
}
}
for (d=0; d<=14; d++) {
printf("%d ",maopao[d]);
}
输出结果为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
如果13换成14,则输出结果为0~14
标签:style color io strong for sp on c r
原文地址:http://www.cnblogs.com/Mr573/p/3989429.html