排序教学幻灯片.pptVIP

  • 3
  • 0
  • 约1.57千字
  • 约 7页
  • 2018-11-29 发布于天津
  • 举报
排序教学幻灯片.ppt

#includestdio.h #define N 10 void sort(int a[],int n) { int i,j,t; for(j=0;jn-1;j++) for(i=0;in-1-j;i++) if(a[i]a[i+1]) { t=a[i]; a[i]=a[i+1]; a[i+1]=t; } };#includestdio.h #includestring.h #define N 10 void main( ) { char a[N][20],b[20]; int i,j; for(i=0;iN;i++) gets(a[i]); printf(\n\n); for(i=0;iN-1;i++) for(j=i+1;jN;j++) if(strcmp(a[i],a[j])0) { strcpy(b,a[i]); strcpy(a[i],a[j]); strcpy(a[j],b); } for(i=0;iN;i++) printf(%s\n,a[i]); printf(\n); };#includ

文档评论(0)

1亿VIP精品文档

相关文档