Problem1900--【高级语言程序设计】10.3 单词数统计

1900: 【高级语言程序设计】10.3 单词数统计

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 2  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

编写一个程序,在习题 10.2 文件内容拆分的基础上,从文本文件中读入这首歌的英文歌词(假设每句诗的字符数不超过 800),然后统计并输出其中的单词数。注意,仅统计以空格和换行为分隔符的单词,类似 they'dshing-a-ling-a-ling 这样的词都当作一个单词来统计。

Input


Sample Input Copy

/data/workspace/myshixun/step1/english.txt

Sample Output Copy

Total words:96

HINT

#include <stdio.h>
#define M   100    //最多80行
#define N   50    //每行最多50个字符
int ReadFile(const char *srcName, char str[][N]);
int CountWords(char str[]);
int main(void)
{
    //=======begin=======





    //========end========
}
//函数功能:从srcName文件中读取字符串,存入数组str,返回字符串总数
int ReadFile(const char *srcName, char str[][N])
{
    //=======begin=======





    //========end========
}
//统计str中的一行字符串中的单词的个数
int CountWords(char str[])
{
    //=======begin=======





    //========end========
}

Source/Category