#include<stdio.h>#include<string.h>/*程序多次调用biodkey(),应包含头文件bios.h*/#include<bios.h><br>/*程序多次调用clrscr(),应包含头文件conio.h*/#include<conio.h>#defineMAX100#definePAGE2#definePRINT1printf("--------------------------------------\n")#definePRINT2printf("NUM---NAME---AGE---MOBILE---ADDRESS\n")#definePRINT3printf("%d,%s,%d,%s,%s,\n",message[i].num,message[i].name,message[i].age,message[i].mobile[15],message[i].address);intsum;structmessage_type{<br>intnum;<br>charname[15];/*name应是数组*/intage;<br>charmobile[15];<br>charaddress[30];/*address应是数组*/}message[MAX];main(){intchoice;sum=read_message();<br>bioskey(0);{clrscr();printf("\n\n\n********通讯录管理系统********\n\n");printf("1.创建资料\n\n");printf("2.输出资料\n\n");printf("3.资料查询\n\n");printf("4.资料添加\n\n");printf("5.资料删除\n\n");printf("6.资料修改\n\n");printf("7.资料整理\n\n");printf("0.退出系统\n\n");printf("请选择(0-7):");scanf("%d",&choice);switch(choice){case1:input_message();break;case2:output_message();break;case3:inquire_message();break;case4:insert_message();break;case5:del_message();break;case6:revise_message();break;case7:sort_message();break;case0:break;}}while(choice!=0);save_message(sum);printf("\n-以上资料已保存!-(文件名:messagenotes.txt)\n");/*保存信息*/save_message(intsum){FILE*fp;inti;if((fp=fopen("messagenotes.txt","wb"))==NULL){printf("读文件错误!\n");return;}for(i=0;i<sum;i++)if(fwrite(&message[i],sizeof(structmessage_type),1,fp)!=1)printf("写文件错误!\n");fclose(fp);/*Function:input_message()*/input_message(){inti=0;/*变量s无用,已删除*/clrsrc();printf("\n\n录入通讯录\n");/*笔误*/printf("\n-------------------------------\n");{printf("\n第%d号录入",i+1);printf("\n编号:");scanf("%d",&message[i].num);if(message[i].num==0)break;printf("\n姓名:");scanf("%s",message[i].name);printf("\n年龄:");scanf("%d",&message[i].age);printf("\n电话:");scanf("%s",message[i].mobile);/*message的mobile是数组,不用取址*/printf("\n地址:");scanf("%s",message[i].address);i++;}while(i<MAX);printf("\n--第%d号录入完毕--\n",i);sum=i;printf("\n按任意键返回住菜单!");/*本语句无效,程序已自动返回菜单*/}/*Function:read_message()*/intread_message(){FILE*fp;inti=0;if((fp=fopen("messagenotes.txt","rb"))==NULL){printf("\n\n*****暂时没有任何保存信息,按任意键进入主菜单选择进行信息录入!*****\n");return;}while(!feof(fp))/*feof()遇文件结束标志时返回非0值,不能依赖于1*{fread(&message[i],sizeof(structmessage_type),1,fp);if(message[i].num==0)break;elsei++;}fclose(fp);return(i);}/*Function:output_message()*/output_message(){inti=0,j=0,count,page=1;clrscr();printf("\n\n--通讯录资料--第%d页\n\n",page);PRINT2;PRINT1;do{if(message[i].num!=0){j++;if(j%PAGE!=0)/*本if句恒假*/{PRINT3;PRINT1;}else{PRINT3;PRINT1;if(message[i+1].num!=0){print("按任意键继续!");bioskey(0);clrscr();printf("\n\n--通讯录资料--第%d页\n\n",++page);PRINT2;PRINT1;}}}i++;}while(message[i].num!=0);printf("按任意键返回主菜单!");bioskey(0);}/*Function:insert_message()*/insert_message(){inti=sum,j,flag=0;charchoice;clrscr();printf("\n\n添加一条资料\n");printf("---------------------------\n");do{<br>message[i].num=++sum;printf("\n新资料编号:%d",message[i].num);printf("\n姓名:");scanf("%s",message[i].name);printf("\n年龄:");scanf("%d",&message[i].age);printf("\n电话:");scanf("%s",&message[i].mobile[15]);printf("\n地址:");scanf("%s",message[i].address);prin...