通訊錄 c 語言

2021-09-02 14:57:49 字數 1653 閱讀 9178

#include

#include

#include

#define true 1000 // 操作成功

#define false -1000 // 操作失敗

typedef char name;

typedef long phone;

typedef struct com

com;

// 建立順序表

com* createperson();

int insert(com* comm);

int search(com* comm);

int del(com* comm);

void sort(com* comm);

void print();

void choose(com* comm);

// 主函式

int main()

mm();

choose(comm);

return 0;//建立

com* createperson()

comm->id = 0;

comm->adr = 0;

comm->comp_num = 0;

comm->next = null;

return comm;

//刪除

int del(com* comm)

int count = 0;

printf (「請輸入要刪除的名字\n」);

char name[10];

scanf ("%s", name);

com* p1;

com* person = comm;

while (person->next)

count++;

}person = person->next;

}

person = comm;

while (person->next)

else

}

person = person->next;

}printf ("該好友不存在\n");

printf ("請輸入命令\n");

return false;

//查詢

int search(com* comm)

name name[10];

printf ("請輸入要查詢的名字\n");

scanf ("%s",name);

com* person = comm;

while (person)

person = person->next;

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

printf ("請輸入命令\n");

return false;

//頭插法

int insert(com* comm)

//將最大的數放在最後

while(count != 0)

else

}count--;

}}//顯示

void display(com* comm)

printf ("請輸入命令\n");

return;// 顯示命令

void print()

通訊錄(C語言)

include include include define m 1000 結構體變數的大小 void insert 增加聯絡人資訊 int delet 刪除聯絡人資訊 void find 查詢指定聯絡人資訊 void change 修改聯絡人資訊 void show 顯示所有聯絡人資訊 void ...

C語言通訊錄

include include include typedef struct atnn 定義結構體 attn void menu 選單 void print attn attn at,int sz 顯示所有聯絡人資訊 void add attn attn at,int sz 新增聯絡人資訊 if s...

通訊錄(C語言)

通訊錄是學完結構體之後檢驗自己掌握知識是否牢固的關鍵 分為三個部分,list.h,list.cpp 和 test.cpp,寫這個通訊錄花了我一上午的時間,已經有了雛形,不過沒有滿足動態開闢空間的要求,也沒有使用檔案格式,所以過幾天我還會寫乙個高階版的。list.cpp include list.h ...