对数组进行直接插入排序

#include
using namespace std;
//数组中的直接插入排序(降序)
void InsertSort(int a[],int n)
{
	int i,j;
	for(i=1;i=0 && t>a[j])
		{
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=t;
	}
	//return s;
}
void main()
{
	int s[6]={4,0,2,3,1,5};
	InsertSort(s,6);
	for(int i=0;i<6;i++)
	   cout<

你可能感兴趣的:(对数组进行直接插入排序)