#include#define size 100typedef struct node{ char c1[size]; int length=0;}sq;int leng1(sq&l){ int i=0; while(l.c1[i]!='\0'){ l.length++; i++; } return l.length;} //求c1长度 int leng2(char c[]){ int b=0,i=0; while(c[i]!='\0'){ i++; b++; } return b; //求c2长度 }main(){ sq l; int num1,num2,num3=0,num4,a=0,i,j; char c2[size],c3[size],c4[size]; printf("请输入存入c1的字符串:"); gets(l.c1) ; printf("请输入存入c2的字符串:"); gets(c2) ; printf("请输入要与c1对比的子串:"); gets(c4); num1=leng1(l); printf("c1长度为:%d\n",num1); num2=leng2(c2); printf("c2长度为:%d\n",num2); if(num1==num2){ for(i=0;i c2[i]?1:-1; printf("%d(1表示c1大,-1表示c2大)\n",a); } } } if(a==0||num1!=num2) printf("两个串相等\n"); //判断相等 for(i=0;i l.length||j l.length) printf("错误!"); else{ for(i;i<=j;i++){ c3[k]=l.c1[i-1]; num3++; k++; } } printf("c3中有数据:"); for(i=0;i