C语言单词统计程序
来源:百度知道 编辑:UC知道 时间:2024/07/02 19:14:00
可能是我没有表达清楚,我要的是可以统计每个单词出现的次数哦~~
/*欢迎加入百度hi群,群号:1140680 */
#include <stdio.h>
#include <string.h>
void main()
{
char str[]="A year after the Golden \nGlobes were reduced to a glorified press conference by the writers strike, the always unpredictable awards show returned in all its goofy glory Sunday night (January 11). The broadcast went from paying solemn tribute to Heath Ledger, to Tina Fey informing BabsonLacrosse to suck it, a four-peat by Slumdog Millionaire and a resurgent Mickey Rourke giving a shout-out to his omnipresent Chihuahuas.";
char read[1000];/**/
char seps[]=" ,.'\n"; /*定义单词的分隔符*/
char * substring;
char temp[100][20];
int i=0;
FILE * pf;
pf=fopen("test.txt","w+r");
fputs(str,pf);
fclose(pf);
/*读文件的字符到字符数组中*/
pf=fopen("test.txt","r");
while(!feof(pf))
{
read[i++]=fgetc(pf);
};
read[i]='\