實現乙個動態版本通訊錄 通訊錄可以增加容量

2021-08-20 06:24:42 字數 1082 閱讀 3433

實現乙個通訊錄; 

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

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

提供方法: 

1. 新增聯絡人資訊 

2. 刪除指定聯絡人資訊 

3. 查詢指定聯絡人資訊 

4. 修改指定聯絡人資訊 

5. 顯示所有聯絡人資訊 

6. 清空所有聯絡人 

7. 以名字排序所有聯絡人 

標頭檔案 contract.h

#ifndef  __contact_h__

#define  __contact_h__

#include

enum option

;#define max_name 20

#define max_*** 5

#define max 1000

#define max_tel 15

#define max_add 30

#define default_sz 3

typedef struct peoinfo

peoinfo;

typedef struct contact

contact, *pcontact;

int addcontact(pcontact pc);

void initcontact(pcontact pc );

void showcontact(pcontact pc);

int delcontact(pcontact pc);

int searchcontact(pcontact pc);

int modifycontact(pcontact pc);

int clearcontact(pcontact pc);

void sortcontact(pcontact pc);

void destroycontact(pcontact pc);

#endif

原始檔 contact.c

}printf("\n");

}void destroycontact(pcontact pc)

主函式

動態版本通訊錄

1.contact.h pragma once ifndef contact h define contact h include include pragma warning disable 4996 define max name 10 define max 5 define max tele ...

動態實現通訊錄

動態實現,借用之前以及寫好的通訊錄 在結構體內新增柔性陣列 主要是柔性陣列的使用 int i 0 list p list malloc sizeof list 100 sizeof int p i 100 for i 0 i 100 i include include include include...

動態通訊錄

動態版通訊錄,是乙個動態增容的過程 自定義標頭檔案部分 ifndef contact h define contact h define max name 20 define max 5 define max tele 12 define max addr 100 define max 1000 d...