Files
python/TangDou/CSP-J/AcWingTraining/MaoPao_1.cpp

20 lines
461 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n = 7;
int a[N] = {12, 2, 14, 6, 7, 10, 8};
int main() {
// 冒泡排序
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (a[j] > a[j + 1]) {
swap(a[j], a[j + 1]);
}
}
}
// 输出一下
for (int i = 0; i < n; i++) {
cout << a[i] << " ";
}
return 0;
}