班级通信录系统汇编课程设计_第1页
班级通信录系统汇编课程设计_第2页
班级通信录系统汇编课程设计_第3页
班级通信录系统汇编课程设计_第4页
班级通信录系统汇编课程设计_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、班级通信录管理系统1需求说明1.1实验要求lolo1建立通讯录,添加一个同学的通信记录,删除一个同学的通信记录,修改一个同学的通信记录,查询一个同学的通信记录,显示所有同学的通信记录,能根据姓名或宿舍号进行排序。l.lo2通信记录包括学号、姓名、电话号码、宿舍号等信息,所有信息最终用文件保存。1.2功能简述lo2。1建立通信录运行程序后,程序自动建立固有的通讯录。lo2.2添加通信记录进入“添加界面,根据提示,依次添加同学的通信记录条目.添加成功,后显示操作成功信息。lo2.3删除通信记录进入“删除”界面,依据姓名删除信息.输入姓名后,显示该同学的所有信息,并显示操作成功。删除后,返回主菜单.

2、1.2。4查询通信记录进入“查询界面,询问用户按姓名或学号查找学生记录。待用户正确输入已存有的用户姓名或学号后,按回车键后显示所有匹配该信息的学生记录。若输入信息错误或是无该用户没记录,则显示操作错误。1.2。5显示所有通信记录进入“显示”界面,将通讯录中所有同学的通讯记录分行显示出来,每行中同学的不同信息间隔表示.1.2.6根据姓名进行排序排序时,显示排序子菜单,按照姓名中字母的升序对记录进行排序。2。7保存通讯记录将填写好的同学通讯记录写入到固定文件中。lo2.8退出班级通信录管理系统选择该功能选项后,退出班级通信录管理系统,关闭文件,返回DOS.2设计说明2。1程序流程图设计Back2各

3、功能之间的关系2o2.1用户输入信息在选择Insert选项后,进入adder子程序,需要用户依次输入姓名、学号、宿舍号、电话号码,输入信息分别存入manelist、studlist、donnlist、telelist数组中。2。2搜索同学记录建立selectbyname和selectbystud子程序,在select子程序中灵活调用,利用相关信息搜索与关键字匹配的同学记录.同时:可以把搜索这个功能提取出来,实现代码的共享.其中,搜索按关键字的类型不同可分为按姓名搜索和按学号搜索。2o3关键字的匹配selectbyname和selectbystud子程序中都需要进行关键字匹配和比较,故把比较关键

4、字的大小提取出来在stiCmp子程序中实现,方便进行搜索和排序。3文档的处理在用户进入班级通信录管理系统时,若要将输入的信息用文件保存,用户可选择Writetofile选项,将缓冲区和文档中的所有记录显示出来.用户退出后,关闭文件。3详细的算法设计主程序的设计start:movaxJatamovds.axmoves.axcallcshdatamenu1:callclearcalldisplaytitlemovah,Olhint21hcmpal,Tjzselcmpal,2jzaddecmpal/3,jzmodicmpal/4,jzdelcmpal,5jzdiscmpal,7jzwrtcmpal,

5、8jzoutljmpmenu1sei:callclearcallselectjmpbackadde:callclearcalladderjmpbackmodi:callclearcallmodifyjmpbackdel:callclearcalldeletejmpbackdis:callclearcalldisdatajmpbackwrt:callclearcallwriteback:leadx.backstr;返回主菜单提示语“Pleaseenter6tobacemainmenu!movah,09hint21hmovah.01hint21heasi,choicemovsi,alcmpal/6

6、1jzmenul;输入6,返回主菜单callclearjmpbackoutl:movah,4chint21hmainendp:主函数结束codeendsendstart3o2学生记录的数据结构namelistdb20dup(20dup(0)studlistdb20dup(20dup(0)dormlistdb20dup(20dup(0)telelistdb20dup(20dup(0)newnamedb20dup(0)newstuddb20dup(0)newdormdb20dup(0)newteledb20dup(0)cntdbldup(O)cntselectdbldup(O)choicedbld

7、up(0)enterdbOdh,Oah,blankdb*$disnamedbName:$disstuddb5Stud:$,disdormdb5Dorm:$disteledb5Tele:$*3学生通讯录信息的显示和输入学生通讯录信息的显示和输入的逻辑实现思想是一样的.都是先找到第i条记录的起始地址,即学号的开始地址.然后根据j的值确定记录内部的偏移地址。然后调用相应的功能实现学生通讯信息的显示和输入。下面以信息的显示为例作详细说明。disdataprocnear;显示所有信息leasi,cnt;循环次数movcl,simovbx,0disdatal:leadx,disnamemovah,09hi

8、nt21hleadx,namelistadddx.bxmovah,09hint21hleadx,blankmovah,09hint21hleadx,disstudmovah,09hint21hleadx,studlistadddx,bxmovah,09hint21hleadx,blankmovah,09hint21hleadx,disdormmovah,09hint21hleadx,dormlistadddx,bxmovah,09hint21hleadx,blankmovah,09hint21hleadx,distelemovah,09hint21hleadx,telelistadddx,bx

9、movah,09hint21hleadx,entermovah,09hint21haddbx.20loopdisdatalretdisdataendp3.4学生信息的搜索根据用户选择的关键字的类型,按照3.3所述的方法找到第i条记录的相应关键字的起始地址。遍历所有的学生通讯录记录,调用repecmpsb语句对记录中的关键字和用户输入的信息相比较。3o5修改一个同学的通信记录通过关键字搜索与之匹配的同学记录,若查找不到,则修改失败。否则提示用户输入新的通讯信息,覆盖原来的信息。3。6按照姓名进行排序Sort函数采用冒泡排序作为算法进行排序,内外循环次数均为同学通讯录记录的条数,由于字符串的交换比

10、较复杂,则将此子过程抽象出来,记为movR函数。使用loop循环依次交换两个记录的字符.删除操作的实现删除数据信息,查询条件为姓名。删除查询结果的具体做法是:先搜索到与关键字匹配的记录,然后用最后一个记录将其覆盖,达到删除的效果。.3o8与文件相关的操作。1创建文件filenamedb,F:StudentListotxt*,00hhandledw?bufferdb20dup(0)error1dbcreatingfilewrong!0dh,0ah.$error2db,writingfilewrong!,0dh,0ah。$wrtstrdb,writetheclassaddressbook!$mov

11、ah,3chmovcx,0leadx,filenameint21hjcerrlmovhandle.ax3o8o2写文件leasi,entmovcljsimoval,clmovdi,0lopl:movah,40hmovbx,handlemovcx,20leadxjiamelistadddx,diint21hjcerr2movah,40hmovbxjiandlemovcx,20leadx,dormlistadddx,diint21hjcerr2movah,40hmovbx,handlemovcx,1leadx,disteleint21hjcerr2movah,40hmovbx,handlemovc

12、x,20leadx,telelistadddx,diint21hjcerr2adddi,20incalmovcl,sisubcl.aljmploplexit2:movah,3ehmovbx,handleint21hexitl:movah,4chint21herrl:movah,9leadx,error1int21hjmpexitlerr2:movah,9leadx,error2int21hjmpexit2retwriteendp3.8o3关闭文件exit2:movah,3ehmovbx,handleint21hexitl:movah,4chint21herrl:movah,9leadx,err

13、or1int21hjmpexitlerr2:movah,9leadx,error2int21hc:v命令提示将-atDorm:123Dorm:456Dorn:789Tele:123456Tele:654321Tele:457895Name:aaaaaaStud:11111111Name:hhhhbbStud:22222222Name:ccccccStud:33333333Key6tomainmenu?4.1 o 2adder函数的执行结果Inputnevirecord?Theinformation?NameZccccccStud=33333333Dorn:789Tele=457895Delet

14、edsuccessfully?Key6tomainmenu?Theinfornation!Name:bbbbbbStud=22222222iDnym;4GA命令提不符-atWane:bbbhhhName:ddddddStud:23343422Stud:22222222Stud:23456754Dopm:123Dorn:456Dorm:478Tele2123456Tele=654321Tele=368903Key6tomainmenu?4o2。7Save函数的执行结果CSTUDEHTL.TXT-记事本文件编辑a)格式coj查看IV)帮助maaabbb$ bbbbbb$ dddddd$ ddddd

15、d$4O 2源程序stacksegmentstack dw512dup (?) stackends$ 3 6 8 8 2 5 7 7 14 4 4T123456$T654321$T36Kge13$T368903?IdatasegmenttitlestrdbWelcometothedkectoiy!,Odh.Oah/Enteiyoiuchoiceplease!Odh,Oah,$menustrdb*1:Select,Odh,Oah/2:Insert,Odh,Oah,3ModifyOdh,Oah/4:Delete5,Odh,Oah/5:Showallrecord,Odh,0ah/7:Writetof

16、ile0dh,0ah/8:EscOdh,Oah,$namelistdb20dup(20dup(0)studlistdb20dup(20dup(0)dormlistdb20dup(20dup(0)telelistdb20dup(20dup(0)newnamedb20dup(0)newstuddb20dlip(0)newdormdb20dup(0)newteledb20dup(0)filenamedbTiXStiidentList.txf,OOhhandledw?bufferdb20dup(0)errorldbcreatingfilewrong!Odh.Oaho$error2dbwritingfi

17、lewrong!,0dh,0ah.$wrtstrdbvritetheclassaddressbook!$cntdbldup(0)cntselectdbldup(0)choicedbldup(O)enterdb0dh,0ah,blankdb$,disnamedbName:$disstuddKStud:$disdormdbDorm:$disteledbele:$backstrdbrKey6tomainmenu!,Odh,Oah,Sselstrldb1:Selectbyiiame0dhOah,*2:SelectbyStiidentNumberOdh,Oah,1$selstrZdb,Themfonna

18、tion!0dh,0ah,$selstr3dbNameisnotexist!Odh,Oah,$selstr4dbStiidentNumbensnotexist!0dh,0ah?Sselstr5dbStudentNumberdiiectoiyisempty!,Odh.Oah,Saddstr1dblnputthenewinformation!Odh.Oah/$1addstr2dbStiidentNumberdiiectoiyisfiill!0dh,0ah/$addstr3dbAddsuccessfiilly!5,Odh,Oah,$modstr1dbNewname:$rmodstr2dbNewsti

19、id:$modstrSdbewdorm:$modstr4db,Newtele:$modstrSdblnputnewrecord!Odh,Oah/$,modstr6db,Modifiedsuccessfully!,Odh,Oah/$delstr1db9StiidentNumberdiiectoiyisempty!,0d,0ah,$delstr2dbDeletedsuccessfiilly!,Odh,Oah,name1dbzhansan$*name2db,lisi$,name3db,wangwu$,StiidentNumber1db1111111SStiidentNumber2db,2222222

20、$StudentNumber3db3333333$dormIdb*123$donn2db,4565,dorm3db789$teleldb423456$rtele2db,654321$,tele3db457895$,dataendscodesegmentmainprocfarassumecs:code,ds:datadisplaytitleprocnearleadx,titlestrmovah,9int21hleadxjnenustrint21hretdisplaytitleendpcshdataprocnearmovbx,0leasi,name1leadi,namelistadddi,bxmo

21、vcx,20cshname11:movaljsimovdi,alincsiincdicmpal/S1jzcshnamel2loopcshnamel1cshname12:addbx,20leasi,name2leadijiamelistadddi,bxmovcx,20cshname21:moval,simovdi,alincsiincdicmpal/$jzcshname22loopcshname21cshname22:addbx,20leasi,name3leadi,namelistadddi.bxmovcx,20cshname31:moval,simovdi,alincsiincdicmpal

22、,$jzcshname32loopcshname31cshname32:addbx,2Omovax,bx;初始化计数器entmovbl,20divblleasi,cntmovsi.almovbx,0leasi,StudentNumberlleadi.studlistadddi,bxmovex,20eshstud11:movalJsimovdi,alincsiincdicmpaL,$jzcshstud12loopeshstud11eshstud12:addbx,20leasi,StudentNumber2leadi,studlistadddi.bxmovex,20cshstud21:moval,

23、simovdi,alincsiincdicmpaL$jzcshstud22loopcshstud21cshstud22:addbx,20leasi,StudentNumber3leadi.studlistadddi,bxmovcx,20cshstud31:moval,simovdi,alincsiincdicmpal,$jzcshstud32loopcshstud31cshstud32:addbx,20movbx,0leasi,dormlleadi,dormlistadddi,bxmovcx,20cshdorm11:moval,simovdi,alincsiincdicmpal,$jzcshd

24、orml2loopcshdorm11cshdorm12:addbx,20leasi,dorm2leadi5dormlistadddi,bxmovcx,20cshdorm21:moval,simovdi,alincsiincdicmpal,$jzcshdorm22loopcshdorm21cshdorm22:addbx,20leasi,dorm3leadi,dormlistadddi.bxmovcx,20cshdorm31:moval,simovdi,alincsiincdicmpal/$jzcshdorm32loopcshdorm31cshdorm32:addbx,20movbx,0leasi

25、,telelleadi,telelistadddi,bxmovcx,20cshtelel1:moval,simovdiTalincsiincdicmpal,$jzcshtele12loopcshtele11cshtelel2:addbx,20leasi,tele2leadi,telelistadddi,bxmovcx,20cshtele21:moval,simovdiTalincsiincdicmpal,$jzcshtele22loopcshtele21cshtele22:addbx,20leasi,tele3leadi.telelistadddi,bxmovcx,20cshtele31:mo

26、valjsimovdi,alincsiincdicmpal,$jzcshtele32loopcshtele31cshtele32:addbx,20retcshdataendpdisdataprocnearleasi,cnt;循环次数movcljsimovbx,0disdatal:leadx5disnamemovah,09hint21hleadxjiamelistadddx,bxmovah,09hint21hleadx.blankmovah,09hint21hleadx,disstudmovah,09hint21hleadx5studlistadddx,bxmovah,09hint21hlead

27、x.blankmovah,09hint21hleadx,disdomimovah,09hint21hleadx,dormlistadddx,bxmovah,09hint21hleadx,blankmovah,09hint21hleadx,distelemovah,09hint21hleadx,telelistadddx,bxmovah,09hint21hleadx,entermovah,09hint21haddbx,20loopdisdatalretdisdataendpadderprocnearleasi,ent;判断学号是否已满moval,sicmpal,20jbadder5leadx,a

28、ddstr2movah,09hint21hjmpadder6adder5:leadx,addstrlmovah,09hint21hleadx,disnamemovah,09hint21hmovclJ9leasi,newnameadderl:movah,01hint21hcmpal.Odhjeadder2movsi,alincsiloopadder1adder2:movaL24hmovsi,alleasi,ent;计算目的地址的偏移量movbl,sixorax,axmoval,20mulblleasi,newnameleadi,namelistadddi,axmovcx,20cldrepmovs

29、bleadx,entermovah,09hint21hleadx,disstudmovah,09hint21hmovcl,19leasi,newstudadder3:movah,01hint21hcmpahOdhjeadder4movsi,alincsiloopadder3adder4:movaL24hmovsi,alleasi,entmovbl,sixorax,axmoval,20mulblleasi,newstudleadi,studlistadddi.axmovcx,20cldrepmovsbleadx,entermovah,09hint21hleadx,disdomimovah,09h

30、int21hmovcl,19leasijiewdormadder7:movah,01hint21hcmpaLOdhjeadder8movsi,alincsiloopadder7adder8:movaL24hmovsi,alleasi,entmovbljsixorax,axmoval,20mulblleasi,newdormleadi,dormlistadddi,axmovcx,20cldrepmovsbleadx,entermovah,09hint21hleadx,distelemovah,09hint21hmovclJ9leasi,newteleadder%movah,Olhint21hem

31、pahOdhjeadderlOmovsialincsiloopadder9adder10:moval,24hmovsi,alleasi,cntmovbl,sixorax,axmoval,20mulblleasi,newteleleadi,telelistadddi,axmovcx,20cldrepmovsbleadx,entermovah,09hint21hleasi,ent;计数器加1moval,siincalmovsi,alleadx,addstr3movah,09hint21hleasi,newnamemovcx,20adder11:moval50movsi,alincsiloopadd

32、er11leasijiewstudmovcx,20adder12:moval,0movsi,alincsiloopadder12leasijiewdormmovcx,20adder13:moval,0movsi,alincsiloopadder13leasi,newtelemovcx,20adder14:moval,0movsi,alincsiloopadder14adder6:retadderendpselbynameprocnearleasi,cntmoval,sicmpaL0jaselname6leadx,selstr5movah,09hint21hjmpselname5selname6

33、:leadx,disnamemovah,09hint21hleasijiewnamemovcx,19seiname1:movah,01hint21hcmpal,Odhjeselname2movsi,alincsiloopselnamelselname2:moval,24hmovsiralleadx,entermovah,09hint21hleasi,cnt;设置循环次数movdx,simovbx,0selname3:leasi,newnameleadi,namelistadddi.bxmovcx,20cldrepecmpsbjzselname4addbx,20decdxcmpdx,0jnzse

34、lname3leadx,selstr3;记录不存在movah,09hint21hjmpselname5selname4:leadx,selstr2;存在movah,09hint21hleadx,disnamemovah,09hint21hleadxjianielistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hleadx,disstudniovah,09hint21hleadx,studlistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hleadx,disdonnmovah,09hint

35、2Ihleadx,dormlistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hleadx,distelemovah,09hint21hleadx,telelistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hmovax,bx;计算器记录查询到的是第几个movbl,20divblincalleasi,cntselectmovsi,alselname5:leasi,newnamemovcx,20selname7:moval,0movsi,alincsiloopselname7retselbyn

36、ameendpselbystudprocnearleasi,entmoval,sicmpal,0jaselstud6leadx.selstr5movah,09hint21hjmpselstud5selstud6:leadx,disstudmovah,09hint21hleasi,newstudmovcxJ9seistud1:movah,Olhint21hcmpal,Odhjeselstud2movsi,alincsiloopselstud1selstud2:moval,24hmovsialleadx,entermovah,09hint21hleasi,ent;设置循环次数movdxjsimov

37、bx,0selstud3:leasi,newstudleadi.studlistadddi.bxmovcx,20cldrepeempsbjzselstud4addbx,20decdxempdx,0jnzselstud3leadx,selstr4;记录不存在movah,09hint21hjmpselstud5selstud4:leadx,selstr2;存在movah,09hint21hleadx,disnamemovah,09hint21hleadxjiamelistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hleadx,disstudmo

38、vah,09hint21hleadx,studlistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hleadx,disdormmovah,09hint21hleadx,dormlistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hleadx,distelemovah,09hint21hleadx4elelistadddx,bxmovah,09hint21hleadx,entermovah,09hint21hselstud5:leasi,newstudmovcx,20selstud7:mova

39、l,0movsi,alincsiloopselstud7retselbystudendpselectprocnearselect1:leadx5selstrlmovah,09hint21hmovah,01hint21hcmpal/rjzselect2cmpal/25jzselect3jmpselectlselect2:callclearcallselbynamejmpselect4select3:callclearcallselbystudselect4:retselectendpmodifyprocnearcallselbynameleasi,cntselectmoval,sicmpal,0

40、jzmodify5leadxjnodstr5movah,09hint21hleadxjnodstrlmovah,09hint21hleasi,newnamemovcx,20modify1:movah,01hint21hcmpal,Odhjzmodify2movsi,alincsiloopmodify1modify2:moval,24hmovsi,alleadx.entermovah,09hint21hjmpmodify6modify5:jmpmodify7modify6:leadxjnodstr2movah,09hint21hleasi,newstudmovcx,20modify3:movah

41、.01hint21hcmpaLOdhjzniodify4movsi,alincsiloopmodify3modify4:moval,24hmovsi.alleadx,entermovah,09hint21hleadxjnodstr3movah,09hint21hleasi,newdormmovcx,20modify10:movah,Olhint21hcmpal.Odhjzmodifyl1movsi,alincsiloopmodify10modifyl1:moval,24hniovsi,alleadx,entermovah,09hint21hleadxjnodstr4movah,09hint21

42、hleasi,newtelemovcx,20modify12:movah,01hint21hcmpal.Odhjzmodifyl3niovsi,alincsiloopmodify12modifyl3:moval,24hmovsi,alleadx,entermovah,09hint2Ihleasi,cntselect;计算被修改数据的偏移量axmovaljsidecalmovbl,20mulblleasijiewname;把新名字拷入leadi,namelistadddi.axmovcx,20cldrepmovsbleasi,newstud;把新学号拷入leadi,studlistadddi.a

43、xmovcx,20cldrepmovsbleasi,newdorm;把新寝室号拷入leadi,dormlistadddi.axmovcx,20cldrepmovsbleasi,newtele;把新电话号码拷入leadi,telelistadddi,axmovcx,20cldrepmovsbleasi,cntselect;计数器清0movax,0movsi,axleadxjnodstr6movah,09hint21hmodify?:leasi,newnamemovcx,20modify8:movahOmovsi,alincsiloopmodify8leasi,newstudmovcx,20mod

44、ify9:moval,0movsi,alincsiloopmodify9leasijiewdormmovcx,20modify14:moval,0movsi,alincsiloopmodify14leasi,newtelemovcx,20modifyl5:moval,0movsi,alincsiloopmodify15retmodifyendpdeleteprocnearIeasi,cntmoval,sicmpahOjadeletelleadx,delstrlmovah,09hint21hjmpdelete2delete1:callselbynameleasi,cntselectmovalJs

45、icmpahOjzdeletelleasi,cntselect;计算要删除数据的偏移量bxmovcl,sideedmoval,20mulclmovbx.axleasi,cnt;计算最后一个数据的偏移量dxmovcl,sideedmoval,20mulclmovdx.axleasi,namelistleadi,namelistaddsi,dxadddi,bxmovex,20cldrepmovsbleasi,studlistleadi,studlistaddsi.dxadddi,bxmovex,20cldrepmovsbleasi,dormlistleadi,dormlistaddsi.dxadd

46、di,bxmovex,20cldrepmovsbleasi,telelistleadi,telelistaddsi.dxadddi,bxmovex,20cldrepmovsbleasi,cnt;计数器减1moval,sidecalmovsi,tselect;cntselect清零moval,0movsi,alleadx,delstr2movah,09hint21hdelete2:retdeleteendpclearprocnearmovah.OfliintiOhmovah,0intiOhretclearendpwriteprocnearleadx,wrtstrmovah,09hint21hmo

47、vah,3ch;创建文件movcx,0leadx,filenameint21hjcerrlmovhandle5axleasi,cntmovcl,simovdi,Olopl:;写入文件movah,40hmovbx,handlemovcx,20leadxjiamelistadddx,diint21hjcerr2movah,40hmovbx,handlemovcx,20leadx5dormlistadddx,diint21hjcerr2movah,40hmovbx,handlemovcxJleadx,disteleint21hjcerr2movah,40hmovbx,handlemovcx,20leadx,telelistadddx,diint21hjcerr2adddi,20jmploplexi;关闭文件movah,3ehmovbxjiandleint21hexitl:movah

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论