#include <iostream>
using namespace std;
void bubble_sort(int list[], int n) {
int i, j, temp;
for(i = n - 1; i > 0; i--) {
for(j = 0; j < i; j++) {
if(list[j] > list[j + 1]) {
temp = list[j];
list[j] = list[j + 1];
list[j + 1] = temp;
}
}
}
}
int main() {
int list[] = {7, 4, 5, 1, 3};
int n = sizeof(list)/sizeof(list[0]);
bubble_sort(list, n);
for(int i = 0; i < n; i++) {
cout << list[i] << endl;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: