基於Linux的通訊錄設計 鍊錶實現

2021-08-21 13:05:11 字數 2109 閱讀 4508

#include

#include

#include

#include

#include

#include

#include

#define n 15

#define false 0

#define ture 1

typedef char elemtype;

typedef int number;

typedef int status;

typedef struct node

node,*linklist;

status iinklist(linklist *l)          //初始化

*l=p;

(*l)->data=0;

int i;

for(i=0;i

(*l)->next=null;

return ture;

}status insert(linklist *l,elemtype name[n],elemtype number[n])    //新建聯絡人

(*l)->data++;

strcpy(p->nam, name);

strcpy(p->num, number);

p->next=tmp->next;

tmp->next=p;

return ture;

}status delete(linklist *l,elemtype name[n])      //刪除聯絡人

while(i<(*l)->data&&tmp->next!=null)

tmp=tmp->next;

}printf("      輸入聯絡人姓名有誤!\n");

return false;

}status get(linklist *l,elemtype name[n])   //查詢聯絡人

printf("      通訊錄中共有%d個聯絡人.\n",(*l)->data);

scanf("%s",name);

tmp=tmp->next;

while(tmp!=null)

tmp=tmp->next;

}printf("      查無此人!\n");

return false;

}status print(linklist *l)        //檢視全部通訊錄

linklist tmp=*l;

tmp=tmp->next;

while(tmp!=null)

return ture;

}status rank(linklist *l)                //按首字母排序

int i=0,j;

linklist a[50];

int flag=false;

while(tmp!=null)

for(i=0;i<((*l)->data)-1;i++)

flag=false;}}

for(i=0;i<(*l)->data;i++)

}status mod(linklist *l,elemtype name[n],elemtype number [n]) //修改聯絡人資訊

tmp=tmp->next;

}printf("      查無此人!\n");

return false;

}status preserve(linklist l)                   //儲存聯絡人資訊

int cal;

tmp=tmp->next;

while(tmp!=null)

close(fd);

return 2;

}int main()

while(read(fd2,&a,sizeof(node))!=0)

close(fd2);

printf("\t已存聯絡人資訊\n");

printf("      ******************\n");

print(printf("      ******************\n");    

while(1)

}return 0;

}

鍊錶通訊錄

include include include define password 208140119 define name max 20 define gender max 10 define str max 20 define tel max 20 鍊錶結構 struct address type...

鍊錶通訊錄

include include include include include struct addressbook typedef struct addressbook addressbook typedef struct addressbook link int main menu void a...

基於c語言鍊錶的通訊錄

本人使用makefile檔案,所以總 分為四部分 tele.h ifndef tele h define tele h include include includestruct node typedef struct node node typedef struct node link void ...