#include
int main()
{
char str[3][20]
char string[20]
int i
for (i = 0i <3i++)
{
gets(str[i])
}
if (strcmp(str[0],str[1])>0)
{
strcpy(string,str[0])
}
else
{
strcpy(string, str[1])
}
if (strcmp(str[2], string)>0)
{
strcpy(string, str[2])
}
printf("\nthe largest string is:%s\n", string)
return 0
更多的话
可以用循环。
应该是按ASCII值进行排序,求得字符串中的字符按此排序规则是最大的。一般用strcmp()函数来实现。如:world >hello
world >words