c语言数组--插入排序

/*
* 构造一个长度为11的一组数组,使用插入排序法进行排序
*/
#include 
#include 

static void InsertSort(int *shuzu);

void main()
{
	system("clear");
	int i=0;	
	int shuzu[11];
	srand((unsigned int)time(NULL));
	for(i=0;i<=10;i++)
	{
		shuzu[i]=rand()%100;
	}
	printf("Original is \n");
	for(i=0;i<=10;i++)
	{
		printf("%d  ",shuzu[i]);
	}
	printf("\n\n\n");
	InsertSort(shuzu);
}
static void InsertSort(int *shuzu)
{
	int i=0,temp=0,j=0,k=0;
	for(i=1;i<=10;i++)
	{
		temp=shuzu[i];
		j=i-1;
		while(j>=0&&temp

你可能感兴趣的:(C&C++日积月累,C程序)