纯代码
#include<stdio.h>
int main()
{ char a[6]={0}, b[6]={0}, c[6]={0}, max[6]={0};
int count;
printf("请分别输入三个字符串:\n");
scanf("%s%s%s", &a, &b, &c);
count = strcmp(a, b);
if (count > 0)
{strcpy(max, a);
count = strcmp(max, c);
if (count < 0)
{ strcpy(max, c);
printf("最大的字符串是:%s\n", max);
}else if(count==0)
printf("最大的字符串是:%s\t%s", max,c);
else printf("最大的字符串是:%s\t%s", max);}
else if (count < 0)
{ strcpy(max, b);
count = strcmp(max, c);
if (count < 0)
{ strcpy(max, c);
printf("最大的字符串是:%s\n", max);
}else if(count==0)
printf("最大的字符串是:%s\t%s", max,c);
else printf("最大的字符串是:%s\t%s", max);}
count = strcmp(a, b);
if (count == 0)
{ strcpy(max, a);
count = strcmp(max, c);
if (count < 0)
{ strcpy(max, c);
printf("最大的字符串是:%s\n", max); }
else if (count > 0)
printf("最大的字符串是:%s\t%s\n", max,b);
else if (count == 0)
printf("三个字符串一样大!!!\n");}
getch();
return 0;
}
End
~
记录留存