【 tulaoshi.com - 编程语言 】
                             
                            用c实现的插入排序法,先输入10个数,然后利用插入排序法进行排序,将结果输出。算法简单,可供初学者学习。  
![]()
![]()
![]()
![]()
!-- frame contents --   !-- /frame contents --
![]()
![]()
![]()
![]()
    #include "stdio.h"
  #include "conio.h"
  main()
  {
        int a[10],r[11];                  
        int *p;
        int i,j;
        for(i=0;i10;i++)
        {
         p=&a[i];
         printf("please scan the NO:
          %d",i);
         scanf("%d",p);
         r[i+1]=a[i];
        }
         r[0]=1;
        for(i=2;i=10;i++)
        {
          r[0]=r[i];
          j=i-1;
          while(r[j]r[0])
              {
                  r[j+1]=r[j];
                  j--;
              }
          r[j+1]=r[0];
        }     for(i=1;i=10;i++) {p=&r[i];printf("form min to max the NO: %d value=%d",i,*p);}  getch();
   }