#include<iostream>
#include<cstdlib>
using namespace std;
int b[6];
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
void insertSort(int a[], int length)
{
for (int i = 1; i < length; i++)
{
for (int j = i - 1; j >= 0 && a[j + 1] < a[j]; j--)
{
swap(a[j], a[j + 1]);
}
for(int i=0;i<11;i++)
{
cout<<a[i]<<" ";
}
cout<<endl;
}
}
int main()
{
int a[] = {11, 9, 20, 7,56, 9,42, 3, 7,15,16 };
insertSort(a, 6);
cout << endl;
system("pause");
return 0;
}