#include
#include
int main()
{
void swap(char* , char* );
char a[20];
char b[20];
char c[20];
printf("please enter three strings:");
gets(a);//获得字符串
gets(b);
gets(c);
if(strcmp(a , b)>0) swap(a , b);
if(strcmp(a , c)>0) swap(a , c);
if(strcmp(b , c)>0) swap(b , c);
printf("The order is: %s,%s,%s\n",a,b,c);
return 0;
}
void swap(char *pt1, char *pt2)//交换字符串
{
char pt[20];
strcpy(pt , pt1);
strcpy(pt1 , pt2);
strcpy(pt2 , pt);