#include <iostream>
using namespace std;
class Sorter {
private:
int arr[5];
public:
Sorter(int a[5]) {
for (int i = 0; i < 5; i++) arr[i] = a[i];
}
void b() {
for (int i = 0; i < 5 - 1; i++) {
for (int j = 0; j < 5 - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
void p() {
for (int i = 0; i < 5; i++) cout << arr[i] << " ";
cout << endl;
}
};
int main() {
int data[5] = {5, 2, 9, 1, 3};
Sorter s(data);
s.b();
s.p();
}
To embed this project on your website, copy the following code and paste it into your website's HTML: