C语言程序设计:字典序排列字符串

问题描述:

对分行输入的若干字符串按字典序(由小到大)进行排序并输出。

控制台输入多行字符串,各个字符串可能含有空格。

输出按字典序(由小到大)进行排序后的字符串。

样例输入:

'Hello World' 'China' 'algorithm' 'computer science' 'programming' 'c language'

样例输出:

'China' 'Hello World' 'algorithm' 'c language' 'computer science' 'programming'

提示:

可以使用字符串数组存储输入的字符串,然后使用标准库函数qsort()进行排序,排序函数的比较函数可以使用strcmp()。

C语言程序设计:字典序排列字符串

原文地址: https://www.cveoy.top/t/topic/omcV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录