0) swap(s1,S2);if(strcmp(s1,s3)>0) s" />
當前位置:成語大全網 - 新華字典 - 輸入三個字符串,按照字典順序從小到大排序。謝謝~ ~ ~

輸入三個字符串,按照字典順序從小到大排序。謝謝~ ~ ~

# include & ltstdio.h & gt

# include & ltstring.h & gt

int main()

{

void swap(char *,char *);

char s1[31],s2[31],S3[31];

scanf("%s%s%s ",s1,s2,S3);

if(strcmp(s1,s2)>0) swap(s1,S2);

if(strcmp(s1,s3)>0) swap(s1,S3);

if(strcmp(s2,s3)>0)互換(s2,S3);

printf("%s %s %s\n ",s1,s2,S3);

返回0;

}

void swap(char *p1,char *p2)

{

char p[31];

strcpy(p,p 1);strcpy(p1,p2);strcpy(p2,p);

}