#include
using namespace std;
#define max 1000
int array[10]={40,17,16,53,90,82,41,13,75,80};
int sort(int n)
{
int j,temp;
for(int i = 1;i < n; i++)
{
if(array[i] < array[i-1])
{
temp = array[i];j = i-1;
do{
array[j+1] = array[j];
j--;
}while(temp <= array[j]);
array[j+1] = temp;
}
for(int i = 0; i< n; i++)
cout<
return 0;
}
int main()
{
int n =10;
sort(n);
cout<<"after sort: "<
}
void InsertSort(int a[], int left, int right)
{
int i, j, tmp;
for(i = left + 1; i <= right; i++)
{
tmp = a[i];
for(j = i - 1; j >= left && a[j] > tmp; j--)
a[j + 1] = a[j];
a[j + 1] = tmp;
for(j = left; j <= right; j++)
printf("%d\t", a[j]);
printf("\n");
}
}
void main( )
{
int i, n, v[100];
scanf("%d", &n); /*输入数据元素个数*/
for(i = 0; i < 10; i++) /*输入数据元素*/
scanf("%d", &v[i]);
InsertSort(v, 0, n - 1);
}