17 lines
393 B
C++
17 lines
393 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 10;
|
|
int a[N] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
|
|
|
|
void bubbleSort(int l, int r) {
|
|
for (int i = l; i <= r; i++)
|
|
for (int j = i + 1; j <= r; j++)
|
|
if (a[i] > a[j]) swap(a[i], a[j]);
|
|
}
|
|
int main() {
|
|
bubbleSort(1, 7);
|
|
for (int i = 0; i <= 9; i++)
|
|
cout << a[i] << " ";
|
|
|
|
return 0;
|
|
} |