统计一篇英文文章的英文单词个数
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/09/25 22:32:56
统计一篇英文文章的英文单词个数
用C语言编写
用C语言编写
/*
本程序由Turbo C2.0编译通过.英文文章请命名为english.txt并放在Turbo C所在目录下.运行结果以文件方式输出,输出文件result.txt也在Turbo C所在目录下.
word是不同的单词;
count是该单词在文章中出现的次数;
percent是文章中各单词出现的频率.
*/
#include "stdio.h"
main()
{
FILE *fp,*result;
char ch='\0';
char word[1000][20]; /* 最多存1000个不同单词,每个单词在20个字符内. */
int count_word[1000]={0}; /* 每个单词对应个数 */
int i=0,j=0,k=0,flag=2,total=0;
float percent; /* 每个单词出现频率 */
clrscr();
if(((fp=fopen("english.txt","r"))&&(result=fopen("result.txt","w")))==NULL)
{
printf("Can't open file\n");
printf("Press any key to exit...");
getch();
exit(0);
}
printf("\nPlease wait...");
while(!feof(fp))
{
ch=fgetc(fp);
if(ch>='a'&&ch='A'&&ch='A'&&ch
本程序由Turbo C2.0编译通过.英文文章请命名为english.txt并放在Turbo C所在目录下.运行结果以文件方式输出,输出文件result.txt也在Turbo C所在目录下.
word是不同的单词;
count是该单词在文章中出现的次数;
percent是文章中各单词出现的频率.
*/
#include "stdio.h"
main()
{
FILE *fp,*result;
char ch='\0';
char word[1000][20]; /* 最多存1000个不同单词,每个单词在20个字符内. */
int count_word[1000]={0}; /* 每个单词对应个数 */
int i=0,j=0,k=0,flag=2,total=0;
float percent; /* 每个单词出现频率 */
clrscr();
if(((fp=fopen("english.txt","r"))&&(result=fopen("result.txt","w")))==NULL)
{
printf("Can't open file\n");
printf("Press any key to exit...");
getch();
exit(0);
}
printf("\nPlease wait...");
while(!feof(fp))
{
ch=fgetc(fp);
if(ch>='a'&&ch='A'&&ch='A'&&ch
统计一篇英文文章的英文单词个数
输入一篇英文文章,以$符号结束,统计其中出现字母,数字的个数,求出现频率最高的字母
word中如何统计英文单词的个数?
求VB程序代码 统计输入的一篇英文文章中的单词数和定冠词the的个数,并将出现的定冠词the全部删除
如何在word中快速统计一篇文章中某个字的个数?
vb语言中怎样统计一篇文章中英文单词的个数
C语言中怎样统计一篇文章中英文单词个数
在word中的“字数统计”统计英文文章的“字数”为11250,这个数是英文单词数还是英文字母数还是.
用C输入一篇英文文章,统计其中出现频率最高的单词
有没有能统计一篇英文文章中所有单词出现次数的软件
用C++输入一篇英文文章,以$符号结束,统计其中出现频率最高的单词
的英文单词我修改了一篇文章,