電商秒殺系統(tǒng)-Spring項目實戰(zhàn)2021
2022-09-26 22:08 作者:janet19961217 | 我要投稿
int algorithm(){
? ?int array[] = {24, 17, 85, 13, 9, 54, 76, 45, 5, 63};
? ?int count = sizeof(array)/sizeof(int);
? ?for (int i = 0; i < count - 1; i ++) {
? ? ?for (int j = 0; j < count - 1 - i; j ++) {
? ? ? ? ?if (array[j] < array[j+1]) {
? ? ? ? ? ?int temp = array[j];
? ? ? ? ? ?array[j] = array[j+1];
? ? ? ? ? ?array[j+1] = temp;
? ? ? ?}
? ? }
?}
? ?for (int index = 0; index < count; index ++) {
? ? ?printf("%d", array[index]);
? ?}
? ?return 0;}
標簽: