作业帮 > 综合 > 作业

提取出英文句子所有单词存到一个单词数组中排序函数对字符串数组进行升序排序在主函数中输出各单词

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/28 03:29:42
提取出英文句子所有单词存到一个单词数组中排序函数对字符串数组进行升序排序在主函数中输出各单词
#include
#include
int GetWords(char *sentence,char *words[]);
void SortStrings(const char *strs[],int count);
int main()
{
\x09char str[200];
\x09int nWords = 0;
\x09char *words[20];
\x09int i;
\x09
\x09printf("input a string:");
\x09gets(str);
\x09
\x09nWords = GetWords(str,words);
\x09SortStrings(words,nWords);
\x09
\x09puts("output:");
\x09for(i=0; i
参考……
int GetWords(char *str,char *words[]){
//
}
这代码不区分大小写.若希望区分大小写,将stricmp改成strcmp即可.
再问: const,,那个是题的代码是不能改的,已经解决不过还是谢谢啦!