版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
/計(jì)算機(jī)科學(xué)與工程學(xué)院課程設(shè)計(jì)報(bào)告題目全稱:通訊錄管理軟件題目難度等級(jí):2指導(dǎo)老師:盧光輝職稱:副教授學(xué)生姓名:楊玉芳學(xué)號(hào):班號(hào):信安四班平時(shí)〔上機(jī)〔10分計(jì)算機(jī)使用技能〔10分課程設(shè)計(jì)報(bào)告〔20分計(jì)算機(jī)專業(yè)技能〔60分加分項(xiàng)〔不超過(guò)5分總分備注:如參加答辯,請(qǐng)答辯老師給出計(jì)算機(jī)專業(yè)技能〔60分的分?jǐn)?shù)。請(qǐng)指導(dǎo)教師給出除計(jì)算機(jī)專業(yè)技能〔60分以外的其他分?jǐn)?shù)。如參加答辯,請(qǐng)答辯老師簽字:主要任務(wù):設(shè)計(jì)一個(gè)基于PC的通訊錄管理軟件,具有圖形用戶界面,能增/刪/改/查找通訊記錄,并存儲(chǔ)為文件。詳細(xì)功能描述:設(shè)計(jì)一個(gè)基于PC的通訊錄管理軟件,具有用戶界面,能增/刪/改/查找通訊記錄,并存儲(chǔ)為文件。預(yù)期成果或目標(biāo):通訊錄管理軟件。指導(dǎo)老師評(píng)語(yǔ):指導(dǎo)教師簽字:摘要通信錄信息管理系統(tǒng)是計(jì)算機(jī)管理電子通信錄的一種計(jì)算機(jī)應(yīng)用技術(shù)的創(chuàng)新,在計(jì)算機(jī)還未普及之前通信管理都是由聯(lián)系人采用名片,筆錄手工記帳的方式來(lái)操作的.現(xiàn)在一般的通信錄管理都是采用計(jì)算機(jī)作為工具的實(shí)用的計(jì)算機(jī)通信錄管理程序來(lái)幫助人們進(jìn)行更有效的通信錄信息管理。通信錄管理系統(tǒng)是典型的信息管理系統(tǒng)<MIS>,其開發(fā)主要包括后臺(tái)數(shù)據(jù)庫(kù)的建立和維護(hù)以及前端應(yīng)用程序的開發(fā)兩個(gè)方面。對(duì)于前者要求建立起數(shù)據(jù)一致性和完整性強(qiáng)、數(shù)據(jù)安全性好的庫(kù);而對(duì)于后者則要求應(yīng)用程序功能完備,易使用等特點(diǎn)。
經(jīng)過(guò)分析,我們使用MICROSOFT公司的VISUALC++6.0開發(fā)工具,利用其提供的各種面向?qū)ο蟮拈_發(fā)工具,尤其是數(shù)據(jù)窗口這一能方便而簡(jiǎn)潔操縱數(shù)據(jù)庫(kù)的智能化對(duì)象,首先在短時(shí)間內(nèi)建立系統(tǒng)應(yīng)用原型,然后,對(duì)初始原型系統(tǒng)進(jìn)行需求迭代,不斷修正和改進(jìn),直到形成用戶滿意的可行系統(tǒng)。關(guān)鍵字:通信錄信息管理,管理信息系統(tǒng),VisualC++6.0,Access,數(shù)據(jù)庫(kù)AbstractThedirectoryinformationmanagementsystemsusingelectronicdirectoryofacomputermanagementcomputerapplicationtechnologyinnovationinthecomputercommunicationsmanagementarenotpopularbeforetheintroductionofbusinesscontacts,Theaccountingapproachtotheoperationmanualtranscription.generaldirectorymanagementarenowusingthecomputerasatoolforcomputerdirectorymanagementprocedurestohelppeoplemoreeffectivelydirectoryinformationmanagement.Directorymanagementsystemisatypicalmanagementinformationsystem<MIS>,includingitsmaindevelopmentbackgroundtotheestablishmentandmaintenanceofthedatabaseandfront-endapplicationdevelopment2.Therequestfortheestablishmentofstrongdataconsistencyandintegrity,goodforthesecurityofthedata.Forthelatterrequestapplicationsfunctions,suchaseasytousefeatures.
Afteranalysis,weuseMicrosoftVisualC++6.0developmenttoolcompanies,theuseofitsvariousobject-orienteddevelopmenttools,especiallydatathatcanbeeasilyaccessibleandconcisewindowmanipulationdatabaseintelligentobjects,thefirstprototypeapplicationsysteminashorttimeandthen,computationoftheinitialprototypesystemneedstoconstantlyreviseandimproveuntiltheformationofaviablesystemofusersatisfaction.keyword:directoryinformationmanagement,managementinformationsystems,VisualC++6.0,Access,SQL.目錄緒論第一章.設(shè)計(jì)系統(tǒng)的必要性和可行性第二章.系統(tǒng)總體設(shè)計(jì)2.1題目要求2.2需求分析2.3總體設(shè)計(jì)2.31系統(tǒng)總體功能單元2.32系統(tǒng)總體流程圖2.33系統(tǒng)運(yùn)行總體界面預(yù)覽第三章.詳細(xì)設(shè)計(jì)3.1通訊錄信息輸入模塊3.2信息瀏覽與排序模塊3.3通訊錄查詢模塊3.4通訊錄更改3.5通訊錄文件操作第四章.調(diào)試與測(cè)試4.1數(shù)據(jù)錄入4.2測(cè)試瀏覽排序功能4.3測(cè)試查詢功能4.4測(cè)試通訊錄的更改操作4.5測(cè)試通訊錄文件操作功能4.6測(cè)試通訊錄其他功能第五章.課程設(shè)計(jì)心得第六章.總結(jié)與展望第七章.參考文獻(xiàn)緒論當(dāng)今時(shí)代是飛速發(fā)展的的信息時(shí)代。在各行各業(yè)中離不開信息處理,這正是計(jì)算機(jī)被廣泛應(yīng)用于信息管理系統(tǒng)的原因。計(jì)算機(jī)的最大好處在于利用它能夠進(jìn)行信息管理。使用計(jì)算機(jī)進(jìn)行信息控制,不僅提高了工作效率,而且大大的提高了其安全性。尤其對(duì)于復(fù)雜的信息管理,計(jì)算機(jī)能夠充分發(fā)揮它的優(yōu)越性。計(jì)算機(jī)進(jìn)行信息管理與信息管理系統(tǒng)的開發(fā)密切相關(guān),系統(tǒng)的開發(fā)是系統(tǒng)管理的前提。隨著市場(chǎng)經(jīng)濟(jì)的發(fā)展和人們生活水平的提高,隨著科學(xué)技術(shù)的發(fā)展,計(jì)算機(jī)領(lǐng)域不斷取得新的研究成果。計(jì)算機(jī)在代替和延伸腦力勞動(dòng)方面發(fā)揮越來(lái)越重要的作用,不僅在工業(yè)方面而且在日常生活中也越來(lái)越離不開計(jì)算機(jī)。本文論述了通訊錄系統(tǒng)的整個(gè)開發(fā)過(guò)程,包括系統(tǒng)分析、系統(tǒng)設(shè)計(jì)、系統(tǒng)實(shí)現(xiàn)等方面。實(shí)現(xiàn)對(duì)通訊錄信息的增、刪、改、查等功能,以多文檔界面形式實(shí)現(xiàn)。該軟件具有方便性、可靠性、壽命長(zhǎng)、可行性、安全性的優(yōu)點(diǎn)。一個(gè)學(xué)校,單位,企業(yè)的通信錄管理是一項(xiàng)重要工作。計(jì)算機(jī)管理通信檔案,日常辦公,實(shí)現(xiàn)現(xiàn)代化辦公,分析通信現(xiàn)狀通過(guò)強(qiáng)大的查詢和索檢高效的索檢出數(shù)據(jù),提高辦事效率。第一章、設(shè)計(jì)系統(tǒng)的必要性和可行性:管理系統(tǒng)是一個(gè)企業(yè)單位不可缺少的部分,它的內(nèi)容對(duì)于企業(yè)的決策者和管理者來(lái)說(shuō)都至關(guān)重要,所以人事勞資管理系統(tǒng)應(yīng)該能夠?yàn)橛脩籼峁┏渥愕男畔⒑涂旖莸牟樵兪侄巍5恢币詠?lái)人們使用傳統(tǒng)人工的方式管理文件檔案,這種管理方式存在著許多缺點(diǎn),如:效率低、保密性差,另外時(shí)間一長(zhǎng)對(duì)于查找、更新和維護(hù)都帶來(lái)了不少的困難。1.1管理信息系統(tǒng)是企業(yè)的信息系統(tǒng),它具備數(shù)據(jù)處理、計(jì)劃、控制、預(yù)測(cè)和輔助決策功能,具體作用如下:〔1用統(tǒng)一標(biāo)準(zhǔn)處理和提供信息,排除使用前后矛盾的不完整的數(shù)據(jù)。〔2完整、及時(shí)提供在管理及決策中需要的數(shù)據(jù)?!?利用指定的數(shù)據(jù)關(guān)系式分析數(shù)據(jù),客觀預(yù)測(cè)未來(lái)?!?向各級(jí)管理機(jī)構(gòu)提供不同詳細(xì)程度的報(bào)告,縮短分析和解釋時(shí)間?!?向各級(jí)管理機(jī)構(gòu)提供不同詳細(xì)程度的報(bào)告,縮短分析和解釋時(shí)間。管理系統(tǒng)是一個(gè)企業(yè)單位不可缺少的部分,它的內(nèi)容對(duì)于企業(yè)的決策者和管理者來(lái)說(shuō)都至關(guān)重要,所以人事勞資管理系統(tǒng)應(yīng)該能夠?yàn)橛脩籼峁┏渥愕男畔⒑涂旖莸牟樵兪侄?。但一直以?lái)人們使用傳統(tǒng)人工的方式管理文件檔案,這種管理方式存在著許多缺點(diǎn),如:效率低、保密性差,另外時(shí)間一長(zhǎng),將產(chǎn)生大量的文件和數(shù)據(jù),這對(duì)于查找、更新和維護(hù)都帶來(lái)了不少的困難??尚行匝芯渴窃谲浖_發(fā)前對(duì)軟件項(xiàng)目的可行性做出細(xì)致而謹(jǐn)慎的評(píng)估。在定義階段及早發(fā)現(xiàn)將來(lái)可能在開發(fā)過(guò)程中遇到的問(wèn)題,及早做出決定,可以避免大量的人力、財(cái)力、時(shí)間上的浪費(fèi)。因此,盡早對(duì)軟件項(xiàng)目的可行性做出細(xì)致而謹(jǐn)慎的評(píng)估是十分必要的。1.2經(jīng)濟(jì)可行性進(jìn)行開發(fā)成本的估算及可能取得效益的評(píng)估,確定待開發(fā)系統(tǒng)是否值得投資開發(fā)。經(jīng)濟(jì)可行性研究涉及范圍較廣,包括成本-效益分析、開發(fā)所需的成本和資源,以及潛在的市場(chǎng)前景。新生報(bào)到系統(tǒng)開發(fā)成本低,面向的是學(xué)校內(nèi)的各個(gè)系,有一定的使用價(jià)值,所以該軟件經(jīng)濟(jì)上可行。第二章、系統(tǒng)總體設(shè)計(jì):2.1題目要求〔1所有記錄保存在一個(gè)數(shù)據(jù)文件中,具有用戶界面;〔2具備記錄添加功能;〔3記錄查詢功能〔如按姓名,電話號(hào)碼查詢;〔4記錄修改功能;〔5記錄刪除和顯示功能。2.2需求分析根據(jù)題目要求,對(duì)通訊錄管理功能進(jìn)行分析,按照要求提供顯示、查詢、修改、刪除和添加等功能,在主菜單中進(jìn)行操作使用。2.3總體設(shè)計(jì)通訊錄總體上分為5個(gè)功能模塊,包括通訊錄信息輸入,通訊錄信息顯示與刪除,通訊錄信息查詢,通訊錄信息修改,通訊錄及文件操作等五部分。2.31系統(tǒng)總體功能單元圖:通訊錄信息通訊錄信息管理系統(tǒng)通訊錄信息輸入通訊錄信息顯示及刪除通訊錄信息查詢通訊錄信息修改通訊錄及文件操作系統(tǒng)總體功能單元圖2.32系統(tǒng)總體設(shè)計(jì)流程圖:開始開始intchoiceintchoice;choice=1choice=1 Y Nchoice=2信息輸入choice=2信息輸入 N choice=3 Ychoice=3=4信息刪除=4信息刪除結(jié)束信息更改信息查詢結(jié)束信息更改信息查詢系統(tǒng)總體設(shè)計(jì)流程圖2.33系統(tǒng)運(yùn)行總體界面預(yù)覽圖:系統(tǒng)運(yùn)行總體界面圖第三章.詳細(xì)設(shè)計(jì):3.1通訊錄信息輸入模塊:概述:主要使用if循環(huán)完成對(duì)通訊錄的原始數(shù)據(jù)錄入。包括姓名,電話號(hào)碼,住址,生日,郵箱,關(guān)系等。代碼:voidadd<structtongxunlurecode[]>{ intn,count=0,t,i,m;/*變量n作為是否保存判斷,t判斷是否繼續(xù)添加,i循環(huán)判斷,m記還可添加數(shù)目*/ FILE*fp; structtongxunlus,p;/*定義新結(jié)構(gòu)s保存新輸入信息,新結(jié)構(gòu)p保存原來(lái)已經(jīng)保存在文件的信息*/ if<<fp=fopen<"f:\\project.txt","a+">>==NULL>{ printf<"Fileopenerror!">; exit<0>; } while<!feof<fp>>{/*計(jì)算文件中已有記錄數(shù)count*/ fscanf<fp,"%s%s%s%s%s%s\n",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ count++; } printf<"|*****************開始添加****************|\n">; printf<"|*******************注意:地址不要超過(guò)十個(gè)字*******************|\n">; for<i=0;i<200;i++>{ printf<"姓名:">; scanf<"%s",&>; printf<"電話號(hào)碼:">; scanf<"%s",&s.phonenumber>; printf<"住址:">; scanf<"%s",&s.address>; printf<"生日:">; scanf<"%s",&s.birthday>; printf<"郵箱:">; scanf<"%s",&s.mail>; printf<"關(guān)系:">; scanf<"%s",&s.relation>; printf<"保存記錄請(qǐng)按1,否則按其他數(shù)字!\n">; printf<"輸入您的選擇:">; scanf<"%d",&n>; if<n==1>{ fprintf<fp,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,s.phonenumber,s.address,s.birthday,s.mail,s.relation>; printf<"保存成功!\n">; count++; system<"pause">; system<"cls">; } elseif<n!=1>{ system<"cls">; break; } if<count<=200>{ system<"cls">;/*一次記錄保存后清屏*/ m=200-count; printf<"您已經(jīng)輸入了%d個(gè)記錄,還可以輸入%d個(gè)!\n",count,m>; } else{ printf<"您的通訊錄已滿!\n">; system<"cls">; } printf<"按0退出添加,按其他數(shù)字繼續(xù)添加!\n">; scanf<"%d",&t>; if<t==0>{ system<"cls">; break; } } if<fclose<fp>>{ printf<"cannotclocethefile!">; exit<0>; }}3.2信息顯示及刪除模塊:概述:本模塊主要完成對(duì)已輸入的通訊錄信息進(jìn)行顯示及刪除,再利用函數(shù)調(diào)用來(lái)完成按照姓名,電話號(hào)碼等進(jìn)行查看的工作。信息顯示代碼:voidshow<structtongxunlurecode[]>{ structtongxunlup;/*定義新結(jié)構(gòu)變量保存要顯示的信息*/ intl,i,j,n=0,m; FILE*fp; if<<fp=fopen<"f:\\project.txt","r+">>==NULL>{ printf<"Fileopenerror!">; exit<0>; } for<j=0;j<200;j++>{ if<feof<fp>> break; fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ n++; } if<n==1>{ printf<"###################################\n">; printf<"###您還沒(méi)有添加任何聯(lián)系人!###\n">; printf<"###################################\n">; } else{ m=ftell<fp>;/*用while〔!feof〔fp直接循環(huán)會(huì)是最后一條信息顯示兩次,此處解決此問(wèn)題*/ fseek<fp,-m,1>;/*將文件指針移向開頭*/ printf<"##################################\n">; printf<"###您總共有以下%d個(gè)聯(lián)系人!###\n",n-1>; printf<"##################################\n">; printf<"||\n">; printf<"|***************通訊錄**************|\n">; printf<"||\n">; printf<"|姓名號(hào)碼地址生日郵箱關(guān)系|\n">; printf<"||\n">; for<j=0;j<n-1;j++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>;/*輸出新結(jié)構(gòu)中項(xiàng)目*/ printf<"||\n">; } } printf<"按0退出查看!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; if<fclose<fp>>{ printf<"cannotclocethefile!">; exit<0>; }}信息刪除代碼:voidomit<structtongxunlurecode[]>{ structtongxunlus,p;/*定義兩個(gè)新結(jié)構(gòu)變量,s用來(lái)保存要查詢的某個(gè)項(xiàng)目,p用來(lái)保存查詢到需輸出結(jié)構(gòu)各項(xiàng)目*/ intflag,a,l,n,i,m=0,q,x=0;/*flag作為判斷查詢開始,a為判斷查詢方式,l為判斷是否退出查詢,n是fteel返回值*/ FILE*fp,*fpz; if<<fp=fopen<"f:\\project.txt","a+">>==NULL>{ printf<"Fileopenerror!">; exit<0>; } if<<fpz=fopen<"f:\\recode.txt","w+">>==NULL>{ printf<"Fileopenerror!">; exit<0>; } printf<"按0選擇姓名查詢刪除,按1選擇號(hào)碼查詢刪除!\n">; printf<"輸入您的選擇:">; scanf<"%d",&a>; if<a==0>{/*用姓名查詢刪除*/ printf<"輸入要?jiǎng)h除的記錄姓名:">; scanf<"%s",&>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ x++; } fseek<fp,0L,0>; for<i=0;i<x-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ n=ftell<fp>; if<strcmp<,>!=0> fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; if<strcmp<,>==0>{ flag=1; break; } } if<flag==1>{ printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>;/*輸出新結(jié)構(gòu)中項(xiàng)目*/ printf<"||\n">; printf<"是否要?jiǎng)h除這條記錄!\n">; printf<"確認(rèn)按1,退出按0\n">; printf<"輸入您的選擇:">; scanf<"%d",&l>; if<l==1>{ fseek<fp,n,0>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;m++; } fseek<fp,n,0>; for<i=0;i<m-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; } printf<"刪除成功!\n">; system<"pause">; system<"cls">; } if<l==0> system<"cls">; } else{ printf<"您的通訊錄中沒(méi)有此記錄!\n">; printf<"按0退出刪除!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; } } elseif<a==1>{/*用號(hào)碼查詢刪除*/ printf<"輸入要?jiǎng)h除的記錄號(hào)碼:">; scanf<"%s",&s.phonenumber>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ x++; } fseek<fp,0L,0>; for<i=0;i<x-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ n=ftell<fp>; if<strcmp<s.phonenumber,p.phonenumber>!=0> fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; if<strcmp<s.phonenumber,p.phonenumber>==0>{ flag=1; break; } } if<flag==1>{ printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; /*輸出新結(jié)構(gòu)中項(xiàng)目*/ printf<"||\n">; printf<"是否要?jiǎng)h除這條記錄!\n">; printf<"按1確認(rèn),按0退出!\n">; printf<"輸入您的選擇:">; scanf<"%d",&l>; if<l==1>{ fseek<fp,n,0>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;m++; } fseek<fp,n,0>; for<i=0;i<m-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; } printf<"刪除成功!\n">; system<"pause">; system<"cls">; } if<l==0> system<"cls">; } else{ printf<"您的通訊錄中沒(méi)有此記錄!\n">; printf<"按0退出刪除!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; } } if<fclose<fp>>{ printf<"cannotclocethefile!">; exit<0>; } if<fclose<fpz>>{ printf<"cannotclocethefile!">; exit<0>; } remove<"f:\\project.txt">; shanjia<recode>;}3.3通訊錄查詢模塊:概述:通過(guò)用For循環(huán)構(gòu)造查詢函數(shù)來(lái)完成查找功能。代碼:voiddemand<structtongxunlurecode[]>{ structtongxunlus,p;/*定義兩個(gè)新結(jié)構(gòu)變量,s用來(lái)保存要查詢的某個(gè)項(xiàng)目,p用來(lái)保存查詢到需輸出結(jié)構(gòu)各項(xiàng)目*/ intflag,a,l;/*flag作為判斷查詢開始,a為判斷查詢方式,l為判斷是否退出查詢*/ FILE*fp; if<<fp=fopen<"f:\\project.txt","r+">>==NULL>{ printf<"Fileopenerror!">; exit<0>; } printf<"按0選擇姓名查詢,按1選擇號(hào)碼查詢!\n">; printf<"輸入您的選擇:">; scanf<"%d",&a>; if<a==0>{/*用姓名查詢*/ printf<"輸入要查詢的姓名:">; scanf<"%s",&>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ if<strcmp<,>==0>{ flag=1; break; } } if<flag==1>{ printf<"||\n">; printf<"|姓名號(hào)碼地址生日郵箱關(guān)系|\n">; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>;/*輸出新結(jié)構(gòu)中項(xiàng)目*/ printf<"||\n">; printf<"按0退出查詢!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; } else{ printf<"您的通訊錄中沒(méi)有此記錄!\n">; printf<"按0退出查詢!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; } } elseif<a==1>{/*用號(hào)碼查詢*/ printf<"輸入要查詢的號(hào)碼:">; scanf<"%s",&s.phonenumber>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ if<strcmp<s.phonenumber,p.phonenumber>==0>{ flag=1; break; } } if<flag==1>{ printf<"||\n">; printf<"|姓名號(hào)碼地址生日郵箱關(guān)系|\n">; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; /*輸出新結(jié)構(gòu)中項(xiàng)目*/ printf<"||\n">; printf<"按0退出查詢!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; } else{ printf<"您的通訊錄中沒(méi)有此記錄!\n">; printf<"按0退出查詢!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; } } if<fclose<fp>>{ printf<"cannotclocethefile!">; exit<0>; } }3.4通訊錄的修改:概述:本模塊主要通過(guò)編寫并調(diào)用調(diào)用rewrite<>,add<>,delete<>函數(shù)對(duì)通訊錄進(jìn)行修改操作。代碼:voidrevamp<structtongxunlurecode[]>{ FILE*fp,*fpz; structtongxunlus,p,m,z;/*定義兩個(gè)新結(jié)構(gòu)變量,s用來(lái)保存要查詢的某個(gè)項(xiàng)目,p用來(lái)保存查詢到需輸出結(jié)構(gòu)各項(xiàng)目*/ intflag,a,l,choice,n,d=0,i,x=0;/*flag作為判斷查詢開始,a為判斷查詢方式,l為判斷是否退出查詢,choice作為判斷刪除項(xiàng)目,d記錄原有文件數(shù),i循環(huán)判斷*/ if<<fp=fopen<"f:\\project.txt","a+">>==NULL>{ printf<"Fileopenerror!">; exit<0>; } if<<fpz=fopen<"f:\\recode.txt","w+">>==NULL>{ printf<"Fileopenerror!">; exit<0>; } printf<"按0選擇姓名查詢修改,按1選擇號(hào)碼查詢修改!\n">; printf<"輸入您的選擇:">; scanf<"%d",&a>; if<a==0>{/*用姓名查詢修改*/ printf<"輸入要修改記錄的姓名:">; scanf<"%s",&>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ x++; } fseek<fp,0L,0>;/*將文件指針定向開頭*/ for<i=0;i<x-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ n=ftell<fp>; if<strcmp<,>!=0> fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; if<strcmp<,>==0>{ flag=1; break; } } if<flag==1>{ printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>;/*輸出新結(jié)構(gòu)中項(xiàng)目*/ printf<"||\n">; m=p; fseek<fp,n,0>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>; d++; } fseek<fp,n,0>;/*用while〔!feof〔fp直接循環(huán)會(huì)是最后一條信息保存兩次,此處解決此問(wèn)題*/ for<i=0;i<d-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; } printf<"是否要修改這條記錄?\n">; printf<"確認(rèn)請(qǐng)按1,退出請(qǐng)按0!\n">; printf<"輸入您的選擇:">; scanf<"%d",&l>; system<"cls">; if<l==1>{ printf<"||\n">; printf<"|修改項(xiàng)目|\n">; printf<"||\n">; printf<"|choice[1]:修改姓名|\n">; printf<"|choice[2]:修改號(hào)碼|\n">; printf<"|choice[3]:修改地址|\n">; printf<"|choice[4]:修改生日|\n">; printf<"|choice[5]:修改郵箱|\n">; printf<"|choice[6]:修改關(guān)系|\n">; printf<"||\n">; printf<"輸入您的選擇:">; scanf<"%d",&choice>; switch<choice>{ case1: printf<"%s",>; printf<"改成:">; scanf<"%s",&>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case2: printf<"%s",m.phonenumber>; printf<"改成:">; scanf<"%s",&m.phonenumber>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case3: printf<"%s",m.address>; printf<"改成:">; scanf<"%s",&m.address>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case4: printf<"%s",m.birthday>; printf<"改成:">; scanf<"%s",&m.birthday>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case5: printf<"%s",m.mail>; printf<"改成:">; scanf<"%s",&m.mail>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case6: printf<"%s",m.relation>; printf<"改成:">; scanf<"%s",&m.relation>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; default: break; } } elseif<l==0> system<"cls">; } else{ printf<"您的通訊錄中沒(méi)有此記錄!\n">; printf<"按0退出修改!\n">; scanf<"%d",&l>; if<l==0> system<"cls">; } } elseif<a==1>{/*用號(hào)碼查詢修改*/ printf<"輸入要修改記錄的號(hào)碼:">; scanf<"%s",&s.phonenumber>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ x++; } fseek<fp,0L,0>; for<i=0;i<x-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>;/*將數(shù)據(jù)保存在新結(jié)構(gòu)變量中*/ n=ftell<fp>; if<strcmp<s.phonenumber,p.phonenumber>!=0> fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; if<strcmp<s.phonenumber,p.phonenumber>==0>{ flag=1; break; } } if<flag==1>{ printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>;/*輸出新結(jié)構(gòu)中項(xiàng)目*/ printf<"||\n">; m=p; fseek<fp,n,0>; while<!feof<fp>>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>; d++; } fseek<fp,n,0>;/*用while〔!feof〔fp直接循環(huán)會(huì)是最后一條信息保存兩次,此處解決此問(wèn)題*/ for<i=0;i<d-1;i++>{ fscanf<fp,"%s%s%s%s%s%s",&,&p.phonenumber,&p.address,&p.birthday,&p.mail,&p.relation>; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,p.phonenumber,p.address,p.birthday,p.mail,p.relation>; } printf<"是否要修改這條記錄?\n">; printf<"確認(rèn)請(qǐng)按1,退出請(qǐng)按0!\n">; printf<"輸入您的選擇:">; scanf<"%d",&l>; system<"cls">; if<l==1>{ printf<"||\n">; printf<"|修改項(xiàng)目|\n">; printf<"||\n">; printf<"|選擇[1]:修改姓名|\n">; printf<"|選擇[2]:修改號(hào)碼|\n">; printf<"|選擇[3]:修改地址|\n">; printf<"|選擇[4]:修改生日|\n">; printf<"|選擇[5]:修改郵箱|\n">; printf<"|選擇[6]:修改關(guān)系|\n">; printf<"||\n">; printf<"輸入您的選擇:">; scanf<"%d",&choice>; switch<choice>{ case1: printf<"%s",>; printf<"改成:">; scanf<"%s",&>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case2: printf<"%s",m.phonenumber>; printf<"改成:">; scanf<"%s",&m.phonenumber>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case3: printf<"%s",m.address>; printf<"改成:">; scanf<"%s",&m.address>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case4: printf<"%s",m.birthday>; printf<"改成:">; scanf<"%s",&m.birthday>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case5: printf<"%s",m.mail>; printf<"改成:">; scanf<"%s",&m.mail>; printf<"||\n">; printf<"|%-7s%-12s%-22s%-10s%-20s%-3s|\n",,m.phonenumber,m.address,m.birthday,m.mail,m.relation>; printf<"||\n">; fprintf<fpz,"%-7s%-12s%-22s%-10s%-20s%-3s\n",,m.phonenumber,m.address,m.birthday,m.mail,z.relation>; printf<"修改成功!\n">; system<"pause">; system<"cls">; break; case6: printf<"%s",m.relation>; printf<"改成:">; scanf<"%s",&m.rel
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 個(gè)人健身教練合同:2024版專業(yè)輔導(dǎo)合同書版B版
- 2025年食堂節(jié)能環(huán)保設(shè)施改造承包協(xié)議9篇
- 2025年高新技術(shù)產(chǎn)業(yè)園區(qū)土地購(gòu)置合同范本3篇
- 2025年度跨境電商供應(yīng)鏈融資擔(dān)保合同4篇
- 2025版企業(yè)綠化項(xiàng)目施工合同范本匯編4篇
- 二零二五版環(huán)保檢測(cè)技術(shù)服務(wù)合同標(biāo)準(zhǔn)范本3篇
- 2024年藥品研發(fā)與藥師合作契約3篇
- 個(gè)人投資合同及投資款支付借條(2024版)3篇
- 2025年度智慧安防系統(tǒng)承包意向書4篇
- 東莞市規(guī)范離婚合同書2024版樣本版
- 檢驗(yàn)員績(jī)效考核
- 農(nóng)藥合成研發(fā)項(xiàng)目流程
- 機(jī)電安裝工程安全管理
- 2024年上海市第二十七屆初中物理競(jìng)賽初賽試題及答案
- 信息技術(shù)部年終述職報(bào)告總結(jié)
- 理光投影機(jī)pj k360功能介紹
- 六年級(jí)數(shù)學(xué)上冊(cè)100道口算題(全冊(cè)完整版)
- 八年級(jí)數(shù)學(xué)下冊(cè)《第十九章 一次函數(shù)》單元檢測(cè)卷帶答案-人教版
- 帕薩特B5維修手冊(cè)及帕薩特B5全車電路圖
- 小學(xué)五年級(jí)解方程應(yīng)用題6
- 年月江西省南昌市某綜合樓工程造價(jià)指標(biāo)及
評(píng)論
0/150
提交評(píng)論