# include <stdio.h>
# include <string.h>
# include <math.h>
main()
{
int t1,t2,t3;
char a[100],b[100],c[100];
gets(a);
gets(b);
gets(c);
t1=strcmp(a,b);
t2=strcmp(a,c);
t3=strcmp(b,c);
if(t1>0&&t2>0)
{
if(t3>0)
{
puts(c);puts(b);puts(a);
}
else
{
puts(b);puts(c);puts(a);
}
}
else if(t1<0&&t3>0)
{
if(t2>0)
{
puts(c);puts(a);puts(b);
}
else
{
puts(a);puts(c);puts(b);
}
}
else if(t2<0&&t3<0)
{
if(t1>0)
{
puts(b);puts(a);puts(c);
}
else
{
puts(a);puts(b);puts(c);
}
}
}1044
最新推荐文章于 2025-08-18 13:55:36 发布
本文介绍了一个简单的C语言程序,该程序通过使用strcmp函数比较三个字符串并按字母顺序进行排序。通过对字符串a、b和c的两两比较,程序确定了正确的排序顺序。
8万+

被折叠的 条评论
为什么被折叠?



