通訊錄 第一版番外篇

2021-12-29 19:59:14 字數 1619 閱讀 3783

#define _crt_secure_no_warnings 1

#ifndef __addressbook_h__ //使用條件編譯,防止重複引入標頭檔案

#define __addressbook_h__

#define name_max 20

#define ***_max 6

#define tele_max 20

#define addr_max 40

#define data_max 1000

typedef enum choice

choice;

#include

#include

#include

typedef struct stu //定義乙個學生資訊的結構體型別

stu;

typedef struct //建立乙個順序表

sequence;

void add(sequence *book);

void delete(sequence *book, char *names);

void change(sequence *book, char *names);

void output(sequence const *book);

void init(sequence *book);

void sort(sequence *book);

void find(sequence *book, char *names);

#endif#include"addressbook.h"

int find_place(sequence *book, char *names)

if (n != book->i)

return n; //如果找到則返回這個位置

return -1; //沒找到返回-1

}void find(sequence *book, char *names)

void add(sequence *book)

else }

void delete(sequence *book, char *names)

else

else

}}void change(sequence *book, char *names)

else }

void output(sequence const *book)

else }

}void init(sequence *book)

void sort(sequence *book)

//if 結束

}if (flag) //如果已經有序,則flag為真

break;

} }printf("排序成功\n");

}#include"addressbook.h"

void meau()

void execute(sequence *book) }}

int main()

//對第一版的乙個優化

用順序表實現的簡易通訊錄(第一版)

實現乙個通訊錄 通訊錄可以用來儲存1000個人的資訊,每個人的資訊包括 姓名 性別 年齡 住址 提供方法 1.新增聯絡人資訊 2.刪除指定聯絡人資訊 3.查詢指定聯絡人資訊 4.修改指定聯絡人資訊 5.顯示所有聯絡人資訊 6.清空所有聯絡人 7.以名字排序所有聯絡人 pragma once defi...

第一版Python程式

coding cp936 import os import cpickle as p class person def init self,name,age,self.name name self.age age self.def str self return name self.name age...

MVC面試第一版

mvc流程 1 使用者向伺服器傳送請求,請求被springmvc 前端控制器 dispatcherservlet 捕獲 2 dispatcherservlet對請求url進行解析,得到請求資源識別符號 uri 4 dispatcherservlet 根據獲得的handler,選擇乙個合適的handl...