(1)能输入和显示所打的单词。(2)能分辨出单词。(3)对重复的单词和已经输入的单词能自动排除。(4)能按A-Z的顺序排版。(5)能将运行结果以文本形式存储。(6)具有添加新单词并重新排版的能力。二、需求分析运行结果以文本方式存储,因而要提供文件的输入输出操作;通过查找操作检查重复单词;提供排序操作实现按A-Z的顺序排版;提供插入操作添加新单词并重新排版。另外通过键盘式菜单实现功能操作选择。三、总体设计整个系统被设计为单词录入模块、文件存储模块和单词浏览模块。其中单词录入模块要完成输入单词、检查是否重复、排序操作。文件存储模块把存放单词的数组中的数据写入文件。单词浏览模块完成英文词典的输出,即文件的输出操作/。数据结构采用指针数组或二维数组。以回车键或空格键作为单词输入结束标志,对重复的单词自动排除可选第一章提到的查找方法,数据结构可采用指针和数组。四、详细设计#includestdio.h#includestring.h#includestdlib.h#defineN1000chardic[N][20];FILE*p;/*清屏*/voidclear(){system(cls);}/*写入文件*/voidWrite(intr){inti;p=fopen(Data.txt,w);for(i=0;ir;i++){fprintf(p,%s\n,dic[i]);}fclose(p);}/*读取文件*/intRead(){intr=0;英文词典排版系统单词录入模块文件存储模块单词浏览模块p=fopen(Data.txt,r);while(fscanf(p,%s,dic[r])!=EOF){r++;}fclose(p);Write(r);returnr;}/*主菜单*/voidPrint(){printf(\n\n);printf(********************************************************\n);printf(*way=1:appendwords*\n);printf(*way=2:lookupwords*\n);printf(*way=3:endwork*\n);printf(*way=4:cheak*\n);printf(********************************************************\n);printf(pleasechooseaway=);}/*字符排序*/intsort(){inti,j,flag=1,r;chars[20];r=Read();for(i=1;ir&&flag==1;i++){flag=0;for(j=0;jr-i;j++){if(strcmp(dic[j],dic[j+1])0){flag=1;strcpy(s,dic[j]);strcpy(dic[j],dic[j+1]);strcpy(dic[j+1],s);}}}Write(r);return0;}/*检查模块*/voidCheak(){intr=0;clear();p=fopen(Data.txt,r);while(fscanf(p,%s,dic[r])!=EOF){printf(%s,dic[r]);r++;}fclose(p);Write(r);if(r==0)printf(thereisnowordinData.txt\n);else{printf(\n\nthereare%dwordsinData.txt!\n,r);}}voidInsert(char*d){inti;charf[20];intr=Read();intflag=0;clear();for(i=0;ir;i++){if(strcmp(d,dic[i])==0){printf(theword%shasalreadyexisted\n,d);flag=1;break;}}if(flag==0){printf(theword%sissuccessfullyadded\n,d);strcpy(dic[r],d);r++;}printf(\n\ncontinueadding,pleaseinputaword;backtomainmenu,input0:\n);while(scanf(%s,f)&&!(f[0]=='0'&&f[1]==0)){flag=0;for(i=0;ir;i++){if(strcmp(f,dic[i])==0){clear();printf(theword%shasalreadyexisted\n,d);flag=1;break;}}if(flag==0){clear();printf(theword%sissuccessfullyadded\n,f);strcpy(dic[r],f);r++;}printf(\n\ncontinueadding,pleaseinputaword;backtomainmenu,input0:\n);}Write(r);sort();clear();return;}/*查找已录入单词*/voidFind(char*s){chart[20];intflag=0;charf[20];intr=0,c,i;inttemp;p=fopen(Data.txt,r);clear();while(fscanf(p,%s,t)!=EOF){strcpy(dic[r],t);r++;temp=strcmp(s,t);if(temp==0){c=r;flag=1;}}Write(r);if(flag){printf(%s'ssequencenumberis%d!\n,s,c);}else{printf(cannotfind%s!\n,s);}printf(\n\ncontinuelookuping,pleaseinputaword;backtomainmenu,input0:\n);while(scanf(%s,f)&&!(f[0]=='0'&&f[1]==0)){flag=0;for(i=0;ir;i++){if(strcmp(f,dic[i])==0){flag=1;c=i+1;break;}}if(flag){clear();printf(%s'ssequencenumberis%d!\n,f,c);}else{clear();printf(cannotfind%s!\n,f);}printf(\n\ncontinuelookuping,pleaseinputaword;backtomainmenu,input0:\n);}clear();return;}/*菜单选择模块*/voidWork(){inti,way;chard[20];while(1){Print();scanf(%d,&way);switch(way){case1:printf(pleaseinputaword:);scanf(%s,d);Insert(d);break;case2:printf(pleaseinputaword:);scanf(%s,d);Find(d);break;case3:printf(allthewordsaresavedinData.txt!);return;case4:clear();Cheak();}}}/*主函数*/voidmain(){Cheak();sort();Work();}五、运行结果:(1)主菜单(2)添加单词界面(3)检查输入的单词