通讯录管理系统_数据结构课程设计(编辑修改稿)内容摘要:

char pp。 printf(==================\n)。 printf( a. 按编号查询 \n)。 printf( b. 按姓名查询 \n)。 printf(==================\n)。 printf( 请 选 择: )。 p=headnext。 scanf(%s,amp。 pp)。 if (pp==39。 a39。 ||pp==39。 A39。 ) { printf(请输入要查找者的编号: )。 scanf(%s,num)。 while (pamp。 amp。 strcmp(p,num)!=0) p=pnext。 11 if ((p==NULL)) p=NULL。 /*没有查到要查找的通讯信息 */ } else if (pp==39。 b39。 ||pp==39。 B39。 ) { printf( 请输入要查找者的姓名: )。 scanf(%s,name)。 while(pamp。 amp。 strcmp(p,name)!=0) p=pnext。 } return p。 } /********通讯录链表上的结点删除 *****************/ void DelNode(LinkList head) { char cho。 ListNode *p,*q。 p=ListFind(head)。 /*调用查找函数 */ if (p==NULL) { printf(没有查到要删除的通讯者 !\n)。 return。 } else if(p!=NULL) { printf(真的要删除该结点吗。 ( y/n) )。 scanf(%s,amp。 cho)。 if (cho==39。 y39。 ||cho==39。 Y39。 ) { q=head。 while ((q!=NULL)amp。 amp。 (qnext!=p)) q=qnext。 qnext=pnext。 /*删除结点 */ free(p)。 /*释放被删结点空间 */ printf(删除成功。 \n)。 } } } /********通讯录链表的输出函数 **********/ void PrintList(LinkList head) { ListNode *p。 12 p=headnext。 printf(编号 姓 名 性别 联系电话 地址 \n)。 printf(\n)。 while (p!=NULL) { printf(%s,%s,%s,%s,%s\n,p,p,p,p,p)。 printf(\n)。 p=pnext。 /*后移一个结点 */ } } void main() { int choice,j=1。 while(j) { printf(\n\n\n\n\n)。 printf(\t\t\t\t通 信 录 链 表 \n)。 printf(\n\t\t\t******************************)。 printf(\n\t\t\t* 1.通讯录链表的建立 *)。 printf(\n\t\t\t* 2.通讯者结点的插入 *)。 printf(\n\t\t\t* 3.通讯者结点的查询 *)。 printf(\n\t\t\t* 4.通讯者结点的删除 *)。 printf(\n\t\t\t* 5.通讯录链表的输出 *)。 printf(\n\t\t\t* 0.退出通讯录管理系统 *)。 printf(\n\t\t\t******************************)。 printf(\n\t\t\t请选择菜单号 (05):)。 scanf(%d,amp。 choice)。 getchar()。 switch(choice) { case 1: { printf(**********************************\n)。 printf(* 通 讯 录 链 表 的 建 立 *\n)。 printf(**********************************\n)。 head=CreateList( )。 flag1=1。 system(cls)。 break。 } 13 case 2: { if(flag1!=1) {printf(请先建立表 !)。 getchar()。 system(cls)。 } else { printf(**********************************\n)。 printf(* 通 讯 者 信 息 的 添 加 *\n)。 printf(**********************************\n)。 printf(编号 姓名 性别 电话 地址 \n)。 printf(************************************* \n)。 p=(ListNode *)malloc(sizeof(ListNode))。 /*申请新结点 */ printf(\n添加的编号 :\n)。 scanf(%s,p)。 printf(\n添加的姓名 :\n)。 scanf(%s,p)。 printf(\n性别 :\n)。 scanf(%s,p)。 printf(\n电话 :\n)。 scanf(%s,p)。 printf(\n地址 :\n)。 scanf(%s,p)。 InsertNode(head,p)。 system(cls)。 } break。 } case 3: { if(flag1!=1) { printf(请先建立表 !)。 getchar()。 system(cls)。 } else { printf(***********************************\n)。 printf(* 通 讯 录 信 息 的 查 询 *\n)。 printf(***********************************\n)。 p=ListFind(head)。 if (p!=NULL) { 14 printf(编号 姓 名 性别 联系电话 地址 \n)。 printf(\n)。 printf(%s,%s,%s,%s,%s\n,p,p,p,p,p)。 printf(\n)。 } else printf(没有查到要查询的通讯者。 \n)。 } break。 } case 4: { if(flag1!=1) { printf(请先建立表 !)。 getchar()。 system(cls)。 }。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。