#include<stdio.h>
int main()
{
int chengJi[8]={55,68,43,8,76,593,66,81};
for (int i = 0; i < 7; i++) {
// int max = i
//
// for (int j = 0; j < 7-i; j++) {
// if (chengJi[max]>chengJi[j]) {
// max = j;
// }
// }
// printf("%d ",chengJi[max]);
// int max = i;
for (int j = 0; j < 7-i; j++) {
if (chengJi[j]<chengJi[j+1]) {
int t = 0;
t = chengJi[j];
chengJi[j]=chengJi[j+1];
chengJi[j+1]=t;
}
}
}
for (int i=0; i<8; i++) {
printf("%d ", chengJi[i]);//定义一个新变量 把排好顺序的新数组打印出来
} printf("\n");
// printf("%d ",chengJi[j+1]);
return 0;
// int t = 0;
//
// t = chengJi[max];
// chengJi[max] = chengJi[i];
// chengJi[i] = t;
}
这两天的笔记 好乱。。,,弄了好久才让我弄明白也是不容易了 0.0 |