#include#include#define max_person_info_size 300
//實現乙個通訊錄程式,完成聯絡人資訊的儲存
//1、新增
//2、刪除
//3、修改記錄
//4、查詢記錄
//5、列印全部記錄
//6、排序記錄
//7、清空全部記錄
//管理
//1、把基本資訊抽象並描述出來(結構體)
//2、需要管理很多資料,就需要組織起來(資料結構)
typedef struct personinfo personinfo;
typedef struct addressbook addressbook;
addressbook g_address_book;
void init()
} int menu()
void empty()
void addpersoninfo()
//必須獲取到乙個指標,修改的內容是乙個預期的內容
personinfo* person_info = &g_address_book.persons[g_address_book.size];
scanf("%s", person_info->name);
scanf("%s", person_info->phone);
++g_address_book.size;
printf("新增聯絡人成功!\n");
} void delpersoninfo()
printf("請輸入要刪除的序號:");
int id = 0;
scanf("%d", &id);
if (id < 0 || id >= g_address_book.size)
g_address_book.persons[id] =
g_address_book.persons[g_address_book.size - 1];
--g_address_book.size;
printf("刪除聯絡人成功!\n");
} void findpersoninfo()
//根據姓名找**
printf("請輸入要查詢的姓名: ");
char name[1024] = ;
scanf("%s", name);
for (int i = 0; i < g_address_book.size; ++i)
break;
} printf("查詢聯絡人成功!\n");
} void updatepersoninfo()
printf("請輸入要修改的序號:");
int id = 0;
scanf("%d", &id);
if (id < 0 || id >= g_address_book.size)
personinfo* info = &g_address_book.persons[id];
printf("請輸入新的姓名:(%s)\n",info->name);
char name[1024] = ;
scanf("%s", name);
if (strcmp(name, "*") != 0)
char phone[1024] = ;
scanf("%s", phone);
if (strcmp(phone, "*") != 0)
printf("更新聯絡人成功!\n");
} void printallpersoninfo()
printf("共列印了 %d 條資料!\n,", g_address_book.size);
printf("列印全部聯絡人成功\n");
} void sortpersoninfo() ;
char sort_phone_number[1024] = ;
int bound, size;
int i = 0;
for (i = 0; i < g_address_book.size; i++)
}
} }
printf("排序所有聯絡人:\n");
printf("排序成功!\n"); }
void clearallpersoninfo() ;
scanf("%s", choice);
if (strcmp(choice,"y") == 0)
else
} typedef void(*func)();
int main() ;
init();
while (1)
if (choice == 0)
arr[choice]();
} system("pause");
return 0;
}
C語言(window)通訊錄程式
include include include define t 1 define f 0 typedef struct message type2 typedef struct node type struct message struct node 雙向迴圈鍊錶 int shuru type2 ...
python通訊錄小程式
最近看 a byte of python 自學python,看完全書之後書最後面有習題,說如果做出來這個程式就可以自稱為python程式設計師 然後我就隨便寫了一下,發現bug真多,哈哈,小程式,也帖出來吧 1 com.address2 filename init py3 先建乙個字典,來存通訊錄資...
通訊錄(C語言)
include include include define m 1000 結構體變數的大小 void insert 增加聯絡人資訊 int delet 刪除聯絡人資訊 void find 查詢指定聯絡人資訊 void change 修改聯絡人資訊 void show 顯示所有聯絡人資訊 void ...