#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <string>
#include <list>
#include <stack>


using namespace std;

void bubbleSort(int list[], int arraySize)
{
bool needNextPass = true;

for (int k = 1; k < arraySize && needNextPass; k++)
{
// Array may be sorted and next pass not needed
needNextPass = false;
for (int i = 0; i < arraySize - k; i++)
{
if (list[i] > list[i + 1])
{
// Swap list[i] with list[i + 1]
int temp = list[i];
list[i] = list[i + 1];
list[i + 1] = temp;

needNextPass = true; // Next pass still needed
}
}
}
for (int a=0;a<arraySize;a++)
{
    cout<<list[a]<<",";
}
}

int main()
{
   int list[6]={23,21,2,45,67,45};
   int x=6;
   bubbleSort(list,x);

   return 0;

}