用c语言编写管理联络方式的小系统

上传人:子 文档编号:43601084 上传时间:2018-06-07 格式:DOC 页数:18 大小:43.50KB
返回 下载 相关 举报
用c语言编写管理联络方式的小系统_第1页
第1页 / 共18页
用c语言编写管理联络方式的小系统_第2页
第2页 / 共18页
用c语言编写管理联络方式的小系统_第3页
第3页 / 共18页
用c语言编写管理联络方式的小系统_第4页
第4页 / 共18页
用c语言编写管理联络方式的小系统_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《用c语言编写管理联络方式的小系统》由会员分享,可在线阅读,更多相关《用c语言编写管理联络方式的小系统(18页珍藏版)》请在金锄头文库上搜索。

1、用用 C C 语言编写管理联络方式的小系统语言编写管理联络方式的小系统#include#include#include#define LEN sizeof(struct linkinfo)struct linkinfostruct linkinfo *first;char name20;char place128;char birthday11;char telephone16;struct linkinfo *next;int datacount = 0,sortname,sorttype;struct linkinfo *p_main,*p_first=NULL,*p_tail = NUL

2、L;int checkempty(char temp)int flag = 0,i;if(strlen(temp) = 0)flag = 1;for(i=0;iname);strcpy(temp,new-name);flag = checkempty(temp);if(flag = 1)free(new);break;printf(“Please input place:“);gets(new-place);printf(“please input birthday:“);gets(new-birthday);printf(“Please input telephone:“);gets(new

3、-telephone);new-next = NULL;new-first = NULL;if(p_first = NULL)p_first = new;elsenew-first = p_tail;p_tail-next = new;p_tail = new;datacount+;void showtopmenu()fflush(stdin);printf(“*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Menu -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*n“);printf(“1 add *n“);printf(“2 update *n“);p

4、rintf(“3 delete *n“);printf(“4 showall *n“);printf(“5 showone *n“);printf(“6 sort *n“);printf(“-*n“);printf(“7 read data from file *n“);printf(“8 write data to file *n“);printf(“-*n“);printf(“0 exit *n“);printf(“*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*n“);printf(“Ple

5、ase choice a command“);void process_add()create(1);showtopmenu();void process_update()int i = 1,index,flag;char temp20;printf(“Please input the data index that you want to update:“);fflush(stdin);scanf(“%d“,p_main = p_first;if(index datacount | index name);printf(“Number%ds place:t%sn“,index,p_main-

6、place);printf(“Number%ds birthday:t%sn“,index,p_main-birthday);printf(“Number%ds telephone:t%sn“,index,p_main-telephone);fflush(stdin);printf(“Please input new name:“);gets(temp);flag = checkempty(temp);if(flag = 1)printf(“New name input error!n“);break;elsestrcpy(p_main-name,temp);printf(“Please in

7、put new place:“);gets(p_main-place);printf(“Please input new birthday:“);gets(p_main-birthday);printf(“Please input new telephone:“);gets(p_main-telephone);break;elsei+;p_main = p_main-next;showtopmenu();void process_delete()int i = 1,index;printf(“Please input the data index that you want to delete

8、:“);scanf(“%d“,p_main = p_first;if(index 0)while(p_main != NULL)if(index = 1)if(p_main-next = NULL)datacount = 0;p_first = NULL;p_tail = NULL;elsep_first = p_main-next;datacount-;break;else if(i = index-1)if(p_main-next-next != NULL)p_main-next-next-first = p_main;p_main-next = p_main-next-next;if(i

9、ndex = datacount)p_tail = p_main;datacount-;break;elsei+;p_main = p_main-next;printf(“Data %d deleted!n“,index);elseprintf(“-No Data-n“);showtopmenu();void process_showall()int i = 0;p_main = p_first;if(p_main =NULL)printf(“-No Data-n“);elseprintf(“%2s %20s %20s %10s %16snn“,“No“,“Name“,“Place“,“Bir

10、thday“,“Telephone“);while(p_main != NULL)printf(“%2d %20s %20s %10s %16sn“,i+1,p_main-name,p_main-place,p_main-birthday,p_main-telephone);i+;p_main = p_main-next;showtopmenu();void process_showone()int i = 1,index;printf(“Please input the data index that you want to show:“);scanf(“%d“,p_main = p_fir

11、st;while(p_main != NULL)if(i = index)printf(“-n“);printf(“Number%ds name:tt%sn“,i,p_main-name);printf(“Number%ds place:t%sn“,i,p_main-place);printf(“Number%ds birthday:t%sn“,i,p_main-birthday);printf(“Number%ds telephone:t%sn“,i,p_main-telephone);break;elsei+;p_main = p_main-next;if(index datacount

12、| index next;if(j=0)p_first = p_main-next;temp-first = p_main-first;temp-next = p_main-next;if(p_main-first != NULL)p_main-first-next = p_main-next;if(p_main-next-next != NULL)p_main-next-next-first = p_main;p_main-first = p_main-next;p_main-next = p_main-next-next;p_temp-first = temp-first;p_temp-n

13、ext = p_main;int bigthan(char *string1,char *string2)int i,len,result=0;len = strlen(string1);for(i=0;istring2i)return(1);else if(string1iname,p_main-next-name)subprocess_exchange(j);elsep_main = p_main-next;else if(sortname = 1 elsep_main = p_main-next;else if(sortname = 2 elsep_main = p_main-next;else if(sortname = 2 elsep_main = p_main-next;if(j = datacount-1)p_tail = p_main;printf(“Sort Co

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号