回主菜单quot getch return void searchname//按姓名查询 int mark0 int i char name20 printfquotntt----------------按姓名查找 --------------------quot printfquotntt 请输入您要查找的姓名:quot scanfquotsquotname fori0iltni if strcmptxli.namename0 printfquotntt------------ 以下是您查找的联系人信息 ---------------quot printfquotntt li.name printfquotntt 电话: squottxli.phone printfquotntt 地址: squottxli.adress printfquotntt---------------------------------------------------quot mark getch return if mark0 printfquotntt 没有找到联系人的信息quot printfquotntt 按任意键返回主菜单quot getch return ////查询联系人函数结束-----------------------------------------------------////删除联系人函数部分开始-------------------------------------------------void deletecd char choic ifn0 /如果通讯录中没有一个记录输出以下部分/ printfquotntt 对不起,文件中无任何纪录quot printfquotntt 按任意键返回主菜单quot getch return systemquotclsquot /清屏/ printfquotntt----------------- 删除菜单 ----------------------quot printfquotntt 1-删除所有 2-删除单个 quot printfquotntt 3-返回主菜单 quot printfquotntt-------------------------------------------------quot printfquotntt 请选择您所所要的服务:quot choicgetch /输入的赋予 choice/ c switch hoic case 1:deleteallbreak case 2:deleteonebreak case 3:menubreak default:menubreak void deleteall//删除所有联系人 printfquotntt 确认删除y/nquot if getchy fclosefp if fpfopenquottxl.txtquotquotwquotNULL /文件空输出/ printfquotntt 不能打开文件,删除失败quot readfile n0 printfquotntt 纪录已删除,按任意键返回主菜单quot getch return else returnvoid deletename//按姓名删除联系人 int ijdeletemark0a0 char name20 printfquotntt 请输入要删除联系人nfquotsquotname /键盘输入姓名/ for iailtni if strcmptxli.namename 0 //对比字符串查找到要删除的联系人 printfquotntt 以下是您要删除的联系人纪录:quot printfquotntt--------------------------------quot printfquotntt li.name printfquotntt 电话: squottxli.phone printfquotntt 地址: squottxli.adress printfquotntt--------------------------------quot printfquotntt 是否删除y/nquot if getchy // 实现删除功能 for jijltn-1j txljtxlj1 /将通讯录的想前移/ n-- deletemark printfquotntt 删除成功quot printfquotntt 是否继续删除y/nquot if getchy deletename /继续调用删除函数/ return else return continue if deletemark0 printfquotntt 没有该联系人的纪录quot printfquotntt 是否继续删除y/nquot if getchy deletename return void deletephone//按电话号码删除联系人 int ijdeletemark0 /变量定义/ char phone20 printfquotntt 请输入要删除联系人电话号码:quot scanfquotsquotphone ifn0 printfquotntt 对不起,文件中无任何纪录quot printfquotntt 按任意键返回主菜单quot getch return for i0iltni if strcmptxli.phonephone0 printfquotntt 以下是您要删除的联系人纪录:quot printfquotntt li.name printfquotntt 电话: squottxli.phone printfquotntt 地址: squottxli.adress printfquotntt 是否删除y/nquot if getchy for jijltn-1j //递推替换实现删除 txljtxlj1 n-- deletemark //记录删除次数 printfquotntt 删除成功quot printfquotntt 是否继续删除y/nquot if getchy deletephone return else return continue if deletemark0 printfquotntt 没有该联系人的纪录quot printfquotntt 是否继续删除y/nquot if getchy return void deleteone//删除单个联系人 char choic printfquotnt----------------------------------------------------------quot printfquotntt 1-按姓名删除 2-按电话删除quot printfquotntt 请选择您所所要的服务:quot printfquotnt----------------------------------------------------------quot choicgetch switch choic case 1:deletenamebreak case 2:deletephonebreak ///删除函数部分结束--------------------------------------------------------///修改联系人函数开始--------------------------------------------------void modify /修改函数/ char choic ifn0 printfquotntt 对不起,文件中无任何纪录quot printfquotntt 按任意键返回主菜单quot getch return systemquotclsquot printfquotntt-----------------修改联系人菜单-----------------------quot printfquotntt 1-按姓名修改 2-按电话修改 quot printfquotntt 任意键-按返回主菜单 quot printfquotntt------------------------------------------------------quot choicgetch switchchoic case 1:modifynamebreak case 2:modifyphonebreak default:menubreak void modifyname char choic int imark0 char name20 printfquotntt 请输入修改要联系人的nfquotsquotname ifn0 printfquotntt 文件中无任何联系人quot printfquotntt 按任意键返回主菜单quot getch mark return fori0iltni ifstrcmptxli.namename0 printfquotntt 以下是您要修改的联系人信息quot printfquotntt 姓名: squottxli.name printfquotntt 电话: squottxli.phone printfquotntt 地址: squottxli.adress printfquotntt 是否修改y/nquot ifgetchy printfquotnt------------请选择修改信息---------------quot printfquotnt 1-修改姓名 2-修改电话 quot printfquotnt 3-修改地址 quot printfquotnt-----------------------------------------quot printfquotnt 请选择您所所要的服务:quot scanfquotsquotampchoic switchchoic case 1: printfquotnt 请输入新anfquotsquottxli.namebreak case2:printfquotnt .
上一篇:
【精品】Android记事本开发
下一篇:
Function GetIp(IP) 获得ip asp