电子英汉字典
电子英汉词典设计1

电子英汉词典设计1电子英汉词典设计一、问题描述:英汉词典作为一个常用的学习工具,是我们经常要使用的。
该系统能完成一个简单的电子英汉词典的功能,如:单词的查找、增词、删除、修改与保护等工作。
二、功能描述:1、在计算机中建立有限规模的电子英汉词典(文件),利用程序实现电子英汉词典的查找、增词、删除、修改与保护工作。
2、词典的内容为:每行对应一个词条,每个词条由两个字符串构成,字符串用若干空格符分开;前一个是单词字符串(英文),后一个是释义字符串(中文),使用分号作为多个释义的分隔符(无空格)。
3、对单词与释义字符串长度的限定分别为很多于20个与40个字符,词条数限定为不多于200条。
4、使用菜单工作方式。
在一个操作执行之后,程序询问是否继续执行该操作。
如输入Y或者y,则重复同一操作,不退回到菜单;如输入其它信息,则回到菜单等待另一次选择。
仅当选择退出操作时,程序应询问是否将修改后的词典存盘,并根据用户选择存盘退出或者不存盘退出。
5、要求整个设计以人为本,用户界面友好。
二、课程设计的要求与数据1、进一步掌握与利用C语言进行程设计的能力;2、进一步懂得与运用结构化程序设计的思想与方法;3、初步掌握开发一个小型有用系统的基本方法;4、学会调试一个较长程序的基本方法;5、学会利用流程图或者N-S图表示算法;6、掌握书写程序设计开发文档的能力。
三、课程设计应完成的工作1、编写完成相应题目的程序;2、编写课程设计报告,课程设计报告的内容应包含下列6个部分:1) 需求分析:包含设计题目、设计要求与系统功能需求分析;2) 总体设计:包含系统总体设计框架与系统功能模块图;3) 全面设计:包含要紧功能模块的算法设计思路与对应的工作流程图;4) 调试分析过程描述:包含测试数据、测试输出结果,与对程序调试过程中存在问题的思考(列出要紧问题的出错现象、出错原因、解决方法及效果等,适当的包含结果截图);5) 总结:课程设计完成了什么功能,是否具有什么扩展功能?还有什么地方需要改进?课程设计过程中的学习体会与收获、对本次课程设计的认识与自己的建等内容;6) 附录:要紧源程序代码,含必要的注释。
电子行业电子英汉字典

电子行业电子英汉字典1. 引言随着电子行业的快速发展,电子产品的普及程度也越来越高。
对于从事电子工作的人来说,掌握电子行业相关的英文术语是必不可少的。
本文档提供了一个电子行业的电子英汉字典,以帮助读者更好地理解和使用相关的英文术语。
2. 电子行业电子英汉字典下面是一些常见的电子行业英文术语及其对应的中文翻译:2.1. Integrated Circuit(集成电路)集成电路是由大量的电子元器件(如晶体管、电阻、电容等)集成在单个芯片上的电路。
它被广泛应用于电子设备中,如计算机、手机、电视等。
2.2. Printed Circuit Board(印刷电路板)印刷电路板是用于支持和连接电子元器件的基础材料。
它由一层或多层导电层和绝缘层构成,上面用导线连接了各个元器件。
2.3. Transistor(晶体管)晶体管是一种用于控制电流流动的电子器件。
它可以作为开关或放大器使用,广泛应用于各种电子设备中。
2.4. Capacitor(电容器)电容器是一种用于存储电荷的电子器件。
它由两个导体之间夹有绝缘介质组成,可用于调整电路的电压和电流。
2.5. Resistor(电阻器)电阻器是一种用于限制电流流动的电子器件。
它可以调整电路中的电流和电压,起到稳定电路性能的作用。
2.6. Diode(二极管)二极管是一种只允许电流单向流动的电子器件。
它通常用于整流电路和信号调理等应用。
2.7. Inductor(电感器)电感器是一种用于储存能量的电子器件。
它由一个螺线圈构成,通过储存和释放磁场来实现对电流的调节。
2.8. Transformer(变压器)变压器是一种用于改变交流电压的电子器件。
它通过电磁感应原理实现输入和输出电压的转换。
2.9. Semiconductor(半导体)半导体是一种介于导体和绝缘体之间的材料。
它在电子行业中被广泛应用,如制造集成电路和光电子器件等。
2.10. Microcontroller(微控制器)微控制器是一种功能强大的集成电路,具有处理器、内存和输入输出引脚等功能。
中学生英汉双语字典电子版

中学生英汉双语字典电子版人之初性本善性相近习相远men at their birth,are naturally good.their natures are much the same;their habits become widely different.苟不教性乃迁教之道贵以专if follishly there is no teaching,the nature will deteriorate.the right way in teaching,is to attach the utmost importancein thoroughness.昔孟母择邻处子不学断机杼of old, the mother of menciuschose a neighbourhoodand when her child would not learn,she broke the shuttle from the loo窦燕山有义方教导五子名俱扬tou of the swallow hillshad the right methodhe taugh five son,each of whom raised the family reputation.养不教父之过教不严师之惰to feed without teaching,is the father's fault.to teach without severity,is the teacher's laziness.子不研习非所宜幼不学旧何为if the child does not learn,this is not as it should be.if he does not learn while young,what will he be when old ?玉不琢不成器人不学不知义if jade is not polished,it cannot become a thing of use.if a man does not learn,he cannot know his duty towards his neighbour.为人子方少时和亲师友学礼仪he who is the son of a man,when he is young,should attach himself to his teachers and friends; and practise ceremonial usages.香九龄能温席孝於亲所当执hsiang, at nine years of age,could warm his parent's bed.filial piety towards parents,is that to which we should hold fast.融四岁能够使梨弟於短宜先知jung, at four years of age,could yield the (bigger) pears.to hehave as a younger brother towards elders, is one of the first things to know.首孝弟次见闻知某数识某文begin with filial piety and fraternal love,and then see and hear .learn to count,and learn to read.一而十十而百百而千千而万units and tens,then tens and hundreds,hundreds and thousands,thousands and then tens of thousands.三才者天地人三光者日月星the three forces,are heaven, earth and man.the three luminaries,are the sun,the moon and the stars.三纲者君臣义父子和亲夫妇顺the three bonds,are the obligation between soverign and subject, the love between father and child,the harmony between husband and wife.曰春夏曰秋冬此四时运不穷we speak of spring and summer,we speak of autumn and winter,these four seasons,revolve without ceasing.曰南北曰西东此四方应乎中we speak of north and south,we speak of east and west,these four points,respond to the requirements of the centre.曰火水木金土此五行本乎数we speak of water, fire,wood,metal and earth.these five elements,have their origin in number.曰仁义礼智信此五常不容经传we speak of charity, of duty towards one neighbour, of propriety, of wisdom, and of truth.these five virtues,admit of no compromise.稻粱菽麦黍稷此六谷人所食rice , spike, millet, pulsewheat, glutinous millet and common millet,these six grains,are those which men eat.马牛羊鸡犬豕此六畜人所饲the horse, the ox, the sheep,the fowl, the dog, the pig.these six animals,are those which men keep.曰喜怒曰哀惧爱恶欲七情具we speak of joy, of angerwe speak of pity, of fear,of love , of hate and of desire.these are the seven passions.匏土革木石金与丝竹实乃八音the gound, earthenware,skinwood, stone metal,silk and bamboo,yield the eight musical sounds.高曾祖父而身身而子子而孙great great grandfather,great grandfather, grandfather, father and self,self and son,son and grandson,自子孙至玄曾实乃九族人之伦from son and grandson,on to great grandson and great great grandson.these are the nine agnates,constituting the kinships of man.父子恩夫妇从兄则友弟则恭affection between father and child,harmony between husband and wife,friendliness on the part of elder brothers,respectfulness on the part of younger brothers,长幼序友与朋君则恭臣则孝procedence(??) between elders and youngers, (probably : precedence ) as between friend and friend.respect on the part of the sovereign,loyalty on the part of the subject.此十义人所同these ten obligations,are common to all men.凡训蒙须讲究详训诂名句读in the education of the young,there should be explanation and eluciation,careful teaching of the interpretations of commentators,and due attention to paragraphs and sentences.为学者必有初小学终至四书those who are learners,must have a beginning.the 'little learning' finished,they proceed to the four books.论语者二十篇群弟子记善言there is the lun yu (discourse or analects),in twenty sections.in this, the various disciples,have recorded the wise sayings of confucious.孟子者七篇止讲道德说仁义the works of mencius,have comprised in seven section.these explain the way and exemplifications thereof,and expound clarity and duty towards one's neighbour.并作中庸子思笔中不略偏和正难于the chung yung (the doctrine of the mean),by the pen of tzu-su;chung (the middle) being that which odes not lean toward! s any side,yung( the course) being that which cannot be changed.作大学乃曾子自修齐至平治he who wrote the 'great learning'was the philosopher tseng.beginning with cultivation of the individual and ordering of the family, it goes on to government of one's own state and ordering of the family.孝经通在四书甜例如六经始复本when the 'classic of filial piety' is mastered,and the 'four books' are known by heart.the next step is to the 'six classics',which may now be studied.诗书易礼春秋号六经当讲求the books of poetry, of history and of changes.the 'rites of chou dynasty, the book of tites, and the 'spring and autum annals'are the six classicswhich should be carefully explained and analysed.有连山有归藏有周易三易详there is the lien shan system,there is the kuei tsangand there is the system of changes of the chou dynasty,such are the 3 systems wh! ich elucidate the changes.存有典谟有训诰存有誓命书之奥there are the regulations and the counsels,the instruction, the annoucements,the oaths, the charges,these are the profundities of the book of history.我周公作周礼著六官存治our duke of chou,drew up the ritual of the chou dynasty,in which he set forth the duties of the six classes of officials; and thus gave a settled form to the government.大小穿备注礼记述圣言礼乐对备the elder and the younger tai,wrote commentaries on the book of rites.they publish the holy words,and ceremonies and music were set in order.曰国风曰雅颂号四诗当讽咏we speak of the kuo feng,we speak of the ya and the sung.these are the four sections of the book of poetry, which should be hummed over and over.诗既亡春秋并作寓优劣别善恶when odes ceased to be made,the spring and autumn annals were produced.th! ese annals contain praise and blame,and distinguish the good from the bad.三传者有公羊有左氏有彀梁the three commentaries upon the above,include that of kung-yang,th at of tsoand that of ku-liang人之初性本善性相近习相远men at their birth,are naturally good.their natures are much the same;their habits become widely different.苟不教性乃迁教之道贵以专if follishly there is no teaching,the nature will deteriorate.the right way in teaching,is to attach the utmost importancein thoroughness.昔孟母择邻处子不学断机杼of old, the mother of menciuschose a neighbourhoodand when her child would not learn,she broke the shuttle from the loo窦燕山有义方教导五子名俱扬tou of the swallow hillshad the right methodhe taugh five son,each of whom raised the family reputation.养不教父之过教不严师之惰to feed without teaching,is the fath! er's fault.to teach without severity,is the teacher's laziness.子不研习非所宜幼不学旧何为if the child does not learn,this is not as it should be.if he does not learn while young,what will he be when old ?玉不琢不成器人不学不知义if j ade is not polished,it cannot become a thing of use.if a man does not learn,he cannot know his duty towards his neighbour.为人子方少时和亲师友学礼仪he who is the son of a man,when he is young,should attach himself to his teachers and friends; and practise ceremonial usages.香九龄能温席孝於亲所当执hsiang, at nine years of age,could warm (his parent's) bed.filial piety towards parents,is that to which we should hold fast.融四岁能够使梨弟於短宜先知jung, at four years of age, 'y')could yield the (bigger) pears.to hehave as a younger brother towards elders,is one of the first th! ings to know.首孝弟次见闻知某数识某文begin with filial piety and fraternal love,and then see and hear .learn to count,and learn to read.一而十十而百百而千千而万units and tens,then tens and hundreds,hundreds and thousands,thousands and then tens of thousands.三才者天地人三光者日月星the three forces,are heaven, earth and man.the three luminaries,are the sun,the moon and the stars.三纲者君臣义父子和亲夫妇顺the three bonds,are the obligation between soverign and subject, the love between father and child,the harmony between husband and wife。
txt版英汉词典Excel版

txt版英汉词典Excel版
介绍
这份文档提供了一份txt版的英汉词典,可以方便地在Excel中使用。
本词典收录了大量常用的英语单词和对应的中文翻译,可以帮助使用者进行英汉互译。
使用方法
2. 打开Excel软件
3. 在Excel中打开词典文件(txt文件)
4. 将文件内容复制粘贴到Excel的单元格中
注意事项
- 词典文件是以txt格式提供,确保在打开文件时选择“文本文档(*.txt)”格式。
- 在复制粘贴时,请选择合适的单元格格式,以确保数据正常对齐。
- 由于词典内容很广泛,可能会占用大量空间,建议在使用时将Excel文件进行保存。
示例
以下是词典文件的部分内容示例:
感谢
感谢您使用本txt版英汉词典Excel版。
如有任何问题或建议,请随时与我们联系。
以上是关于txt版英汉词典Excel版的简要介绍和使用方法。
如果您有任何问题,请随时与我们联系。
谢谢!。
几款电子词典

看图查询、
多词典查询
、单词跳查
、模糊查询
、惯用语查
询、例句查
询、追加查
询、缺字查
词典功能
询、例句解 释查看、学
习薄、多种
输入方式、
彩图登录、
辞书快捷切
换、格式变
换、字体缩
放、查询记
录、收藏夹
、计算器、
日历(附农
历)/时钟、
用户名登录
MP3播放 不支持
几款电子
发音
英式、美式 双发音
复读 支持 电子书 支持 背光灯 无
彩图登录、
辞书快捷切
换、格式变
换、字体缩
放、查询记
录、收藏夹
、计算器、
日历(附农
历)/时钟、
用户名登录
主体
品牌
诺亚舟 Noah
型号 NP1500
颜色 银色
类型 学习机
功能
手写 支持 MP3播放 支持
复读 支持
MP3播放 不支持
电子书 支持
主体
品牌
诺亚舟 Noah
型号 ND580
颜色 黑色
类型 电子词典
功能
词典功能
内置11部版 权词典
规格
扩展
TF(MicroSD )卡
CASIO VOICE真人 发音技术, TTS全文发 发音 音技术。10 万英语单词 真人发音, 会话真人发 音
复读 不支持
电子书 支持
背光灯 有
规格
显示屏幕 彩屏 内存容量 2G
CASIO VOICE真人 发音技术, TTS全文发 其它 音技术。10 万英语单词 真人发音, 会话真人发 音
电子书 支持
背光灯 有
滑动触摸板
电子词典的优缺点

电子词典的优缺点电子词典的优点1、小巧轻便与传统的纸质词典相比较,电子词典最直观的优点便是小巧轻便、便于携带。
电子词典的主要部件包括一个LCD 、26个字母的输入键盘、电池仓、耳机及USB 插孔。
通常是巴掌大小,拇指厚度,重量在500克左右,随身携带装在口袋里都不成问题。
2、查阅快速对广大学生来说,电子词典的查阅速度要快于纸质词典。
查阅电子词典时,使用者只需利用键盘输入单词即可查到相应词条。
例如,要在电子词典上查阅“apple”这个单词,只需输入“A”、“P”、“P”、“L”、“E”五个字母,就能得到解释。
3、发音功能电子词典作为当代科技进步的产物,具有纸质词典所没有的发音功能,而发音对语言学习者十分重要。
电子词典的发音功能可以帮助学生通过听和模仿,更直接、更快速地学习和掌握发音技巧。
4、内容丰富现在的电子词典里不仅有英汉双解、汉英、同反义词、习语、搭配等英语词典,有些电子词典还收录有大英百科全书、日语词典、新华字典、汉语大词典、成语词典、古汉语常用词词典等多种词典。
学生利用电子词典可以轻松快捷地查阅很多知识和资料。
电子词典的缺点1、词条数量少电子词典收入的词条数量少于纸质词典。
考虑到内存有限,电子词典的设计者和生产商在录入词典时,会去掉一些不常见、不重要的词条,比如一些含有特殊文化含义的词、拟声词、词组等。
2、单词释义少电子词典中的单词释义内容少于纸质词典,这是电子词典最让人头疼的问题。
纸质词典对单词的解释力求言简意赅。
而电子词典能做到言简,却不能保证意赅。
目前,市场上流行的电子词典往往仅用一到两个近义词对单词做出解释,然后给出中文意思(通常比它们给出的英文释义还要简短的多),删掉了能帮助人们更准确、更全面地了解单词的释义部分。
3、收入不规范词典在一般的电子词典中,很少有收入《新时代汉英大词典》或《新世纪汉英大词典》这样的权威汉英词典的。
可能由于知识产权问题,有些电子词典中录入的汉英词典水平不很高、缺乏权威性,有的电子词典甚至录入的是来路不明的词典。
dictionary怎么读

dictionary怎么读dictionary的音标为[?d?k??nri],中文释义为字典。
例句:You can usually also personalize a computer dictionary.你还通常可以根据个人需要设计一个电脑词典。
dictionary 英[?d?k??nri] 美[?d?k??neri]n. 字典;词典短语:chinese-english dictionary 汉英词典;汉英字典;汉英辞典electronic dictionary 电子字典english-chinese dictionary 英汉字典data dictionary 数据字典;资料字典oxford english dictionary 牛津英语词典例句:1.I looked it up in the dictionary.我在词典里查过这个词。
2.This dictionary is available in electronic form.本词典有电子版。
3.You can usually also personalize a computer dictionary.你还通常可以根据个人需要设计一个电脑词典。
4.The new edition of the dictionary carries 7,000 additions to the language, which purists say is under threat.新版词典为该语种增加了7000个词条,纯粹派说该语种正受到威胁。
5.It seems only reasonable to ask students to buy a dictionary.要学生买一本词典,好像也没什么不合情理。
6.This dictionary gives phonetic transcriptions of all headwords.本词典所有词目都注出了音标。
电子英汉词典课程设计

课程设计报告2020~2021学年第一学期课程可视化程序设计课程设计题目电子英汉词典院(系): 计算机学院(软件学院)姓名学号专业班级2019级计科2班指导教师2020年 12 月 31 日目录第一章绪论 (1)1.1 课题背景及意义 (1)1.2 开发环境及技术 (2)第二章概要设计 (2)2.1页面设计 (2)2.1.1 系统首页设计 (2)2.1.2 注册界面设计 (3)2.2 数据库设计 (4)2.2.1 数据库概念结构设计 (4)2 2.2数据库逻辑结构设计 (6)2.2.3 数据库物理结构设计 (7)第三章功能详细设计与实现 (8)3.1实现的全部功能表 (9)3.2功能1 (10)3.3功能2 (11)3.4功能3 (12)3.5功能4 (13)3.6功能5 (14)3.7功能6 (15)3.8功能7 (16)第四章检测及评价 (17)第五章结语 (23)第一章绪论当今时代是信息化时代,而信息的数字化也越来越被人们所重视,所以,数字化技术的重要性也逐渐体现了出来,主要体现在以下几个方面: 数字化是数字计算机的基础,数字化是软件技术的基础,是智能技术的基础,数字化是信息社会的技术基础,数字化是信息社会的经济基础。
词典作为一种为大众服务的工具书,已经渐渐退居二线了,进而出现了另一种查找方式更加简便,更加精确,词汇量更加丰富而且随身携带更加方便的工具,那就是电子英汉词典,应该说这是一个新旧交替的过程,电子英汉词典取代传统词典只是时间的问题。
所以说电子词典的发展前景是明朗的,电子英汉词典生产厂家也如同雨后春笋般崛起了。
电子英汉词典是一种将传统的印刷词典转成数码方式、进行快速查询的数字学习工具。
电子英汉词典以轻便易携、查询快捷、功能丰富等特点,成为21世纪学生学习生活、社会人士移动办公的掌上利器。
它不仅可实现英译汉、汉译英的基本翻译功能,还可以让用户根据自己的需要添加、修改、删除词库,形成自己的词库。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
课程设计(论文)说明书课题:电子英汉字典学院:电子工程与自动化专业:测控技术与仪器学生姓名:覃娇容学号: ************** : ***摘要英汉字典作为一个常用的学习工具,是我们经常要使用的。
运用C语言编写程序,使得系统能完成一个简单的电子英汉词典的功能,如:单词的查找、增词、删除、修改和保存等功能。
关键字:C语言、电子英汉字典、查找、增词、删除、修改、保存、显示目录1 设计任务与要求 (4)2 总体设计 (4)3 详细设计 (5)3.1 设计思路 (5)3.2 各功能模块实现的具体流程 (5)3.2.1 菜单显示 (5)3.2.2 查找 (6)3.2.3 增加 (8)3.2.4 删除 (9)3.2.5 修改 (11)3.2.6 显示 (13)4 调试分析 (15)总结与心得 (20)参考文献 (21)附录 (22)电子英汉字典设计1 设计任务与要求:该设计要求实现简单电子英汉字典的功能,具体管理操作包括单词的添加、显示、查找、删除、修改和保存等。
(1)使用结构体实现,每个数据的结构应包括:单词的英文拼写,单词的中文释义。
(2)系统功能:A.词条录入:即添加单词记录。
B.信息显示:将所有的单词按字母顺序显示。
C.词条修改:对已经输入的单词信息进行修改。
D.词条删除:删除某个单词记录。
E.单词查询:输入单词英文拼写,输出该单词的中文释义。
F.信息保存:将单词信息保存到文件。
G.退出系统。
2 总体设计系统功能分析:本系统可以实现词条录入、信息显示、词条修改、词条删除、单词查询、信息保存、退出系统等功能。
系统功能模块图如图2.1、图2.2所示。
图2.1系统功能模块图(1)图2.2系统功能模块图(2)3 详细设计3.1 设计思路:根据设计任务与要求,该设计主要实现简单电子英汉字典的功能。
具体实现单词的录入、显示、查找、修改、删除、保存与退出等功能。
单词录入之后将自动保存到文件中,然后调用显示函数,将保存在文件中的单词信息按照单词字母顺序排序前后显示出来。
调用查找函数,可以查找保存在文件中的单词信息并显示出来。
调用修改函数,可以对保存在文件中的信息进行修改。
调用删除函数,可以对保存在文件中的信息进行修改。
3.2 各功能模块实现的具体流程:3.2.1 菜单显示:打开运行窗口,进入菜单显示页面。
根据菜单的提示,选择继续执行或者是退出。
switch (a){case 1:Search(); break;//查找case 2:Append(); break;//添加case 3:Delete(); break;//删除case 4:Update(); break;//修改case 5:Display(); break;//显示default :break;//退出}根据菜单提示,输入a,选择要执行的指令。
具体流程如图3.2.1所示。
图3.2.1菜单显示流程图3.2.2 查找:选择查找指令后,提示你输入要查找的单词。
输入要查找的单词后,开始判断文件中是否存在此单词,若存在则显示出此单词及其意译,否则提示不存在此单词,然后提示你是否继续执行。
可以进行显示也可以到你所建立的文本文档里查看是否存在你所要查找的单词。
fp = fopen("G:\\file.txt", "rb");for (i=0; i<W; i++){fread(&word[i], sizeof (struct zidian), 1, fp);if (strcmp(word[i].danci, chazhao) == 0){printf("%s\t%s\n", word[i].danci, word[i].yisi);printf("继续执行请输入指令,否则退出程序\n");scanf("%d", &a);break;}}fclose(fp);if (i == W){printf("不存在此单词!\n");printf("继续执行请输入指令,否则退出程序\n");scanf("%d", &a);}将要查找的单词跟文件中存有的单词进行比较,若文件中存在所要查找的单词,则输出该单词及其意译,否则输出“不存在此单词!”。
具体流程如图3.2.2所示。
图3.2.2查找模块的流程图我的查找方法是:将保存在文件中的单词内容读出,然后将要查找的单词与之进行一一比较。
这一方法非常笨拙。
较好的方法可以是:先将保存在文件中的单词进行排序,然后用二分查找的方法来进行查找。
这一查找方法是较好的,可是之前没有想到,后来老师问起才想起这一方法。
今后有机会,我一定再改改这算法。
3.2.3 增加:选择录入单词的指令,提示你录入要添加的单词,如果文件里面存储的单词达到W(在程序中我设W=20)个了,就会提醒你“储存已满,不能增词”。
如果没有超过,那就引导你输入你想增加的单词及其意思。
若你所增加的单词之前已经存储,就会提醒你“已存在此单词”,否则即可成功增加单词。
后面还会提示你是否继续执行。
可以进行显示也可以到你所建立的文本文档里查看是否存在你所要查找的单词。
fp = fopen("G:\\file.txt", "a");//添加单词时以追加的方式打开文件。
fread(&word[i], sizeof (struct zidian), 1, fp);if (strcmp(word[i].danci, zengci) == 0){printf("已存在此单词!\n");printf("继续执行请输入指令,否则退出程序\n");scanf("%d", &a);break;}//判断文件中是否已存在所要添加的单词,若已存在则提示“已存在此单词”。
fwrite(&word[i], sizeof (struct zidian), 1, fp);fclose(fp);//否则,将所要添加的单词写入文件中进行保存。
具体流程如图3.2.3所示。
在比较单词是否存在时也是与查找的方法一样,也是进行一一比较。
其实,我也可以先将文件中的单词进行排序然后再用二分查找的方法来比较的查找的。
这样的话,时间复杂度就要比我所用的那种一一比较的方法小得多。
图3.2.3增加模块的流程图3.2.4 删除:选择删除指令,出现“请输入需要删除的单词”,后面输进你想删除的单词,然后根据提示语输入单词,若输入的单词在文件中不存在则会提醒你“不存在此单词”。
否则就会告诉你成功删除了。
且之后会提示你是否继续执行。
可以进行显示也可以到你所建立的文本文档里查看是否删除成功。
fread(&word[i], sizeof (struct zidian), 1, fp);if (strcmp(word[i].danci, shanchu)==0)//要删除的单词存在,进行删除{t = 1;k = i;printf("确定要删除请输入3,否则退出程序\n");scanf("%d", &a);if (3 == a){for (j=0; j<D;j++){word[i].danci[j] = '\0';word[i].yisi[j]= '\0';}for (i=k; word[i+1].danci[0] !='\0'; i++){strcpy(word[i].danci, word[i+1].danci);strcpy(word[i].yisi, word[i+1].yisi);for(j=0; j<D;j++){word[i+1].danci[j] = '\0';word[i+1].yisi[j]= '\0';}}}if (i == W)//否则提示不存在此单词{printf("不存在此单词!\n");printf("继续执行请输入指令,否则退出程序\n");scanf("%d", &b);}for (i=0; i<W; i++)//加入这一部分才能成功删除,否则无法删除{fread(&word[i], sizeof (struct zidian), 1, fp);}fclose(fp);fp = fopen("G:\\file.txt", "wb");for (i=0; word[i].danci[0] != '\0'; i++){fwrite(&word[i], sizeof (struct zidian), 1, fp);}fclose(fp);具体流程如图3.2.4所示。
图3.2.4删除模块流程图3.2.5 修改:选择修改指令。
会出现“请输入需要修改的单词”的提示语,后面输进你想修改的单词,若此单词不存在,系统将会提示你“不存在此单词”,否则,会提示你是修改单词还是意译,然后,系统会根据你的选择,提示你输入单词或者意译,之后就会告诉你修改完成了。
后面还会提示你是否继续执行。
可以进行显示也可以到你所建立的文本文档里查看是否修改成功。
fread(&word[i], sizeof (struct zidian), 1, fp);if (strcmp(word[i].danci, xiugai) == 0)//要修改的单词存在{printf("修改单词输入41,修改意译输入42\n");scanf("%d", &a);if (a == 41){for (j=0; j<D;j++){word[i].danci[j] = '\0';}printf("请输入修改后的单词\n");scanf("%s", xiugaih);strcpy(word[i].danci, xiugaih);//修改单词fclose(fp);}if (a == 42){for (j=0; j<D;j++){word[i].yisi[j]= '\0';}printf("请输入修改后的意译\n");scanf("%s", xiugaihy);strcpy(word[i].yisi, xiugaihy);//修改意思fclose(fp);}printf("修改成功!\n");printf("继续执行请输入指令,否则退出程序\n");scanf("%d", &b);break;}}fclose(fp);if (i == W)//不存在要修改的单词{printf("不存在此单词!\n");printf("继续执行请输入指令,否则退出程序\n");scanf("%d", &b);}for (i=0; i<W; i++)//加入这一部分才能成功修改,否则无法修改{fread(&word[i], sizeof (struct zidian), 1, fp);fclose(fp);fp = fopen("G:\\file.txt", "wb");for (i=0; word[i].danci[0] != '\0'; i++){fwrite(&word[i], sizeof (struct zidian), 1, fp);}fclose(fp);具体流程如图3.2.5所示。