#include<vector>
#include <iostream>
#include <string>
using namespace std;
template<class Iter>
void BubbleSort(const Iter &begin, const Iter &end) {
int count = 1;
for (auto fp = begin; fp != end; fp++) {
for (auto sp = begin; sp != (end - count); sp++) {
if (*sp > *(sp + 1)) {
auto temp = *sp;
*sp = *(sp + 1);
*(sp + 1) = temp;
}
}
count++;
}
}
int main() {
vector<int> arr{ 22,15,4,6,234,43,44, 21};
BubbleSort(arr.begin(), arr.end());
for (auto i = arr.begin(); i != arr.end(); i++) {
cout << *i << " ";
}
cout << endl;
system("pause");
return 0;
}