利用鍊錶實現通訊錄

2021-08-13 15:30:22 字數 1327 閱讀 4603

用鍊錶實現乙個

可以用來儲存資訊的通訊錄,每個人的資訊包括:

姓名、性別、年齡、**、住址

程式如下:

#include#include#include#define len sizeof(struct student)											

struct student

;void menu() //目錄格式

struct student *creat() //建立鍊錶

p2->next = null;

return head;

}struct student *add(struct student *head,int index) //增加聯絡人

if(p1->i == index)

else

}else

return head;

}struct student *delete(struct student *head,char name[20]) //刪除聯絡人

if(strcmp(p1->name,name) == 0)

else

}else

free(p1);

return head;

}struct student *modify(struct student *head,char name[20]) //修改聯絡人

if(strcmp(p->name,name)==0)

else

return head;

}struct student *find(struct student *head,char name[20]) //查詢聯絡人

if(strcmp(p1->name,name)==0)

else

printf("目前通訊錄沒這個寶寶!\n");

}

void show(struct student *head) //列印鍊錶

while(p != null);

} else

printf("目前通訊錄沒寶寶!\n");

}struct student *clear(struct student *head)

int main()

case 2:

case 3:

case 4:

case 5:

case 6:

default:

}}}

程式比較淺顯易懂 ,這裡就不做具體分析 ,大家可以自己多多琢磨分析語句。

鍊錶通訊錄

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 通訊錄設計 鍊錶實現

1新增學生資訊 2刪除學生資訊 3顯示學生資訊 4查詢學生資訊 5學生資訊排序 6清空螢幕資訊 7清空文件資訊 8退出管理系統 上 include include include include 讀寫檔案的標頭檔案 using namespace std struct elementtype str...