实验六
1.编程实现:输入两个英文名字串,比较两个串的串长和串的大小,按要求输出结果。 (比如,输入的两个名字串:Tom 与 Charli,输出结果为: 较长的串是 Charli, 较 大的串是:Tom) #include<stdio.h> #include<stdlib.h> #include<string.h> #define STR_LEN 80 int main() { char s1[STR_LEN+1],s2[STR_LEN+1]; printf("first str:"); gets(s1); printf("second str:"); gets(s2); if(strlen(s1)>strlen(s2)){ printf("%s is the longer string.\n",s1); } else if(strlen(s1)<strlen(s2)){ printf("%s is the longer string.\n",s2); } else{ printf("%s and %s are same longer.\n",s1,s2); } if(strcmp(s1,s2)<0){ printf("%s is the largest string.\n",s2); } else if(strcmp(s1,s2)>0){ printf("%s is the