统计文件中的单词个数并输出(C语言)
分析:用单链表存储单词和单词的个数,从文件中读出一个单词,判断单词是否是第一次出现,如果是第一次出现就创建结点插入链表后,否则该单词数+1。
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
typedef struct node
{
char c[30];
int count;
struct node *next;
}node,*link;
node *firstWord(node *head,char word[])//判断单词是不是第一次出现
{
node *p=head;
while(p->next != NULL)
{
if(str