插入排序
#include <iostream>
using namespace std;
void sort_(int test[],int nLen)
{
int j = 0;
for(int i = 1;i<nLen;i++)
{
int temp = test[i];
j=i-1;
while(temp < test [j])
{
test[j+1] = test[j];
j--;
}
test[j+1] = temp;
}
}
void main()
{
int test []={1,3,5,9,7,2,4,6,8,10,0};
int nLen = sizeof (test)/sizeof(int);
sort_(test,nLen);
for(int i =0;i<nLen;i++)
{
cout<<test[i]<<",";
}
cout<<endl;
system("PAUSE");
}