子字符串排序的关键代码
2021-02-08 09:18
阅读:813
标签:main turn col lib char strcmp 字符串 代码 ring
#include#include string.h> #include int main() { char s[20]; char *p[11],temp; while(gets(s)) { int i,j,len; len=strlen(s); for(i=0;i ) { p[i]=(char *)malloc(sizeof(len-i)); strcpy(p[i],s+i); } for(i=0;i 1;i++) for(j=0;j 1-i;j++) if(strcmp(p[j],p[j+1])>0) { temp=*p[j]; *p[j]=*p[j+1]; *p[j+1]=temp; } for(i=0;i ) printf("%s\n",p[i]); } return 0; } /* char *p[11]; len=strlen(s); for(i=0;i */
子字符串排序的关键代码
标签:main turn col lib char strcmp 字符串 代码 ring
原文地址:https://www.cnblogs.com/zmmm/p/12771668.html
评论
亲,登录后才可以留言!