如何编写一个用插空法对n个数排序的程序
让我做一回伸手党吧 谢谢各位大大~
#include <stdio.h> void print_date (int a,int b) { printf("n = %d , m = %d",a,b); } int pailie (int a,int b) { int tmp = 1; for (b--;0!=(b+1);b--) { tmp*=(a-b); } return tmp; } int zuhe (int a,int b) { int c,d=1,e=1; c=b; for (--c;(c+1)!=0;--c) { d*=(a-c); } c=b; for (--c;(c+1)!=0;--c) { e*=(b-c); } return d/e; } int main (void) { int x,y,i,tmp,choose; printf("input 2 number\n"); printf("the one="); scanf("%d",&x); printf("the two="); scanf("%d",&y); if (y>x){ i=x; x=y; y=i; } do { printf("\n m A n input 1 \t m C n input 2 :"); scanf("%d",&choose); } while (choose>2); print_date (x,y); switch (choose) { case 1: tmp = pailie (x,y); printf("\n n A m =%d\n",tmp); break; case 2: tmp = zuhe (x,y); printf("\n n C m =%d\n",tmp); break; } scanf("%d",&i); return 0; }