《高级语言程序设计》
课程设计任务书
课程名称:________________________
设计题目:________________________
专业班级:________________________
学 号:________________________
学生姓名:________________________
指导老师:________________________
起止日期:________________________
目录
第一章:设计题目与思路
1.1设计题目
通讯录
1.2设计思路
- 通讯录课程设计涉及知识:结构体,数组,函数,指针,文件操作以及图形化节目的使用。
- 程序说明:设计一个通讯录,能够实现通讯录的基本操作,并且保持在文件中,此通讯录提供以下主要功能:
- 通讯录欢迎界面,实现对所有函数的调用
- 菜单设计,实现通讯录功能选择
- 初始化通讯录,并且加载文件信息到通讯录
- 检查通讯录空间是否已满,扩容通讯录
- 加载通讯录背景图片
- 录入联系人信息
- 查询联系人信息
- 修改联系人信息
- 浏览所有联系人信息
- 保存通讯录到文件
- 销毁动态开辟空间
- 退出通讯录
- 各菜单项功能
菜单项如下图所示:
- 初始化通讯录:自动加载文件中的联系人,并且生成初始通讯录结构体并且分配初始空间。
- 新建联系人:输入联系人的姓名,籍贯,电话号码1,电话号码2以及邮箱。
- 浏览通讯录:打印通讯录所有联系人信息。
- 修改联系人:输入联系人姓名,修改其信息。
- 查询联系人:输入联系人姓名,显示此联系人信息。
- 保存通讯录:将通讯录所有联系人信息保存到文件。
- 退出通讯录:退出通讯录,结束程序,给出是否保存通讯录的提示并且自动调用销毁动态空间的函数。
功能函数声明实例:
void Initdiretory(Dire* dire);//初始化顺序表存储联系人信息
void Input_message(Dire* dire);//信息录入功能
void Browse_message(const Dire* dire);//信息浏览功能
void Check_message(Dire* dire);//信息查询功能
void Redact_message(Dire* dire);//信息修改功能
void Save_Directory(Dire* dire);//将通讯录保存到文件中
辅助函数声明实例:
void menu();//系统菜单
void New_space(Dire* dire);//检查空间是否已满,若已满分配新空间
void Load_Directory(Dire* dire);//将文件中已经存在的通讯录加载到现有通讯录中
void Destory(Dire* dire);//销毁通讯录,注意要在保存之后,会自动进行保存
void Welcome();//通讯录欢迎图形界面
void loadimage(int x);//加载图片的函数
第二章:数据结构设计描述
2.1 联系人结构体和通讯录结构体的设计
联系人结构体:
typedef struct Contact//定义联系人结构体
{
char name[MAX_NAME];//姓名
char address[MAX_ADDRESS];//籍贯/地址
char phone_number1[MAX_PHONENUM];//电话号码1
char phone_number2[MAX_PHONENUM];//电话号码2
char elec_mailbox[MAX_ELECMAILBOX];//电子邮箱
}Contact;
通讯录结构体:
typedef struct Directory
{
Contact* directory;//指向通讯录的指针
int capacity;//通讯录顺序表的容量
int contact_amount;//通讯录当前的联系人数量
}Dire;
其中,联系人采取的是顺序存储的方法,并且通过链表让他们形成线性结构,便于调用每个联系人的信息,能够动态地申请空间,并且更加方便我们对于增删查改操作的实现。
2.2 常量的定义和作用
#define INIT_SIZE 3//联系人顺序表初始空间为3个联系人结构体大小
#define NEW_SIZE 5//联系人顺序表每次追加的空间为2个联系人结构体大小
#define MAX_NAME 10//名字的最大长度
#define MAX_ADDRESS 80//籍贯最大长度
#define MAX_PHONENUM 11//电话号码最大长度
#define MAX_ELECMAILBOX 50//电子邮箱最大长度
之所以使用这么多常量去代替通讯录中一些关键值,是为了在后续对于通讯录的更新中能够更加方便地进行操作。
2.3.调用的头文件
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<graphics.h>
#include<conio.h>
#include<string.h>
第三章:功能设计
3.1 系统功能模块描述
3.2 新建联系人函数流程图
3.3查找联系人函数流程图
3.4修改联系人函数流程图
以上3.2到3.4,展示了三个较为复杂的函数的流程图,有助于我们对于功能实现流程的理解,接下来展示程序总流程的简介。
3.5程序总流程图简介
第四章:系统测试
- 进入通讯录菜单
1.鼠标左击初始化联系人
2.点击新建联系人
点击每一项,输入信息,点击确定
点击确定,完成新建
3.返回菜单,点击查找联系人,输入姓名
屏幕显示联系人相关信息,完成查找联系人
- 点击修改联系人,输入姓名
点击确定,输入修改信息,完成修改联系人
- 点击浏览通讯录,所有联系人信息被显示,此时只有一个联系人
- 点击保存通讯录,通讯录信息被保存至文件
第五章:课程设计总结
5.1遇到的问题
- 对于图形化函数使用不过熟练,界面不够美观。
- 函数功能不够完善,比如查找和修改联系人只能通过姓名查找到联系人,另外同名联系人的问题没有得到解决。
- 对于文件操作不过熟练,常常忘记一些函数的作用。
5.2心得体会
通过这次通讯录的设计,让我能够充分使用所有知识,进一步了解编程知识的奥妙。对于自身的缺陷有了深刻的认识,认为能够更好地改善自我。
源码展示
directory.h//放置函数声明和常量以及头文件引用
#pragma once
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<graphics.h>
#include<conio.h>
#include<string.h>
#define INIT_SIZE 3//联系人顺序表初始空间为3个联系人结构体大小
#define NEW_SIZE 5//联系人顺序表每次追加的空间为2个联系人结构体大小
#define MAX_NAME 10//名字的最大长度
#define MAX_ADDRESS 80//籍贯最大长度
#define MAX_PHONENUM 11//电话号码最大长度
#define MAX_ELECMAILBOX 50//电子邮箱最大长度
typedef struct Contact//定义联系人结构体
{
char name[MAX_NAME];//姓名
char address[MAX_ADDRESS];//籍贯/地址
char phone_number1[MAX_PHONENUM];//电话号码1
char phone_number2[MAX_PHONENUM];//电话号码2
char elec_mailbox[MAX_ELECMAILBOX];//电子邮箱
}Contact;
typedef struct Directory
{
Contact* directory;//指向通讯录的指针
int capacity;//通讯录顺序表的容量
int contact_amount;//通讯录当前的联系人数量
}Dire;
void menu();//系统菜单
void Initdiretory(Dire* dire);//初始化顺序表存储联系人信息
void New_space(Dire* dire);//检查空间是否已满,若已满分配新空间
void Input_message(Dire* dire);//信息录入功能
void Browse_message(const Dire* dire);//信息浏览功能
void Check_message(Dire* dire);//信息查询功能
void Redact_message(Dire* dire);//信息修改功能
void Load_Directory(Dire* dire);//将文件中已经存在的通讯录加载到现有通讯录中
void Save_Directory(Dire* dire);//将通讯录保存到文件中
void Destory(Dire* dire);//销毁通讯录,注意要在保存之后,会自动进行保存
void Welcome();//通讯录欢迎图形界面
void loadimage(int x);//加载图片的函数
directory.c//放置所有函数的实现代码
#define _CRT_SECURE_NO_WARNINGS 1
#include"directory.h"
void loadimage(int x)//图片载入函数
{
if (x == 1)
{
IMAGE image;
loadimage(&image, "./image.jpg ");
putimage(0, 0, &image);
}
else
{
IMAGE image;
loadimage(&image, "./image2.jpg ");
putimage(0, 0, &image);
}
}
void Welcome()
{
Dire dire;
aa:;
initgraph(800, 500, SHOWCONSOLE);
setbkcolor(WHITE);
cleardevice();
loadimage(1);
setbkmode(TRANSPARENT);
settextcolor(BLACK);
settextstyle(50, 20, "楷体");
outtextxy(100, 80, "通");
outtextxy(100, 130, "讯");
outtextxy(100, 180, "程");
outtextxy(100, 230, "序");
outtextxy(100, 280, "设");
outtextxy(100, 330, "计");
setfillcolor(RGB(148, 186, 222));
fillrectangle(200, 50, 600, 90);
settextstyle(30, 20, "楷体");
outtextxy(260, 55, "初始化通讯录");
fillrectangle(200, 100, 600, 140);
settextstyle(30, 20, "楷体");
outtextxy(270, 105, "新建联系人");
fillrectangle(200, 150, 600, 190);
settextstyle(30, 20, "楷体");
outtextxy(270, 155, "浏览通讯录");
fillrectangle(200, 200, 600, 240);
settextstyle(30, 20, "楷体");
outtextxy(270, 205, "修改联系人");
fillrectangle(200, 250, 600, 290);
settextstyle(30, 20, "楷体");
outtextxy(270, 255, "查询联系人");
fillrectangle(200, 300, 600, 340);
settextstyle(30, 20, "楷体");
outtextxy(270, 305, "保存通讯录");
fillrectangle(200, 350, 600, 390);
settextstyle(30, 20, "楷体");
outtextxy(270, 355, "退出通讯录");
//根据鼠标在不同位置的左击执行不同的函数
while (1)
{
MOUSEMSG msg = GetMouseMsg();
if (msg.x > 200 && msg.x < 600 && msg.y>50 && msg.y < 90)
{
setlinecolor(RED);
rectangle(200, 50, 600, 90);
if (msg.uMsg == WM_LBUTTONDOWN)
{
Initdiretory(&dire);//初始化通讯录
goto aa;
}
}
else if (msg.x > 200 && msg.x < 600 && msg.y>100 && msg.y < 140)
{
rectangle(200, 100, 600, 140);
if (msg.uMsg == WM_LBUTTONDOWN)
{
Input_message(&dire);//信息录入
goto aa;
}
}
else if (msg.x > 200 && msg.x < 600 && msg.y>150 && msg.y < 190)
{
rectangle(200, 150, 600, 190);
if (msg.uMsg == WM_LBUTTONDOWN)
{
Browse_message(&dire);//浏览通讯录
goto aa;
}
}
else if (msg.x > 200 && msg.x < 600 && msg.y>200 && msg.y < 240)
{
rectangle(200, 200, 600, 240);
if (msg.uMsg == WM_LBUTTONDOWN)
{
Redact_message(&dire);//查询联系人
goto aa;
}
}
else if (msg.x > 200 && msg.x < 600 && msg.y>250 && msg.y < 290)
{
rectangle(200, 250, 600, 290);
if (msg.uMsg == WM_LBUTTONDOWN)
{
Check_message(&dire);//修改联系人
goto aa;
}
}
else if (msg.x > 200 && msg.x < 600 && msg.y>300 && msg.y < 340)
{
rectangle(200, 300, 600, 340);
if (msg.uMsg == WM_LBUTTONDOWN)
{
Save_Directory(&dire);//保存通讯录
goto aa;
}
}
else if (msg.x > 200 && msg.x < 600 && msg.y>350 && msg.y < 390)
{
rectangle(200, 350, 600, 390);
if (msg.uMsg == WM_LBUTTONDOWN)//退出通讯录
{
HWND hwnd = GetHWnd();
MessageBox(hwnd, "请确定通讯录已保存", "提示", MB_OKCANCEL);
Destory(&dire);
return;
}
}
}
}
void Initdiretory(Dire* dire)
{
dire->directory = (Contact*)malloc(INIT_SIZE * sizeof(Contact));//初始化是给其分配INIT_SIZE个空间
if (dire->directory == NULL)
{
HWND hwn1 = GetHWnd();
MessageBox(hwn1, "初始化失败", "初始化通讯录", MB_OKCANCEL);
return;
}
dire->capacity = INIT_SIZE;//总容量为INIT_SIZE
dire->contact_amount = 0;//当前联系人数量为0
FILE* fp = fopen("Directory.txt", "rb");
if (fp == NULL)
{
HWND hwn = GetHWnd();
MessageBox(hwn, "通讯录初始化失败", "初始化通讯录", MB_OKCANCEL);
return;
}
Contact tmp = { 0 };
while (fread(&tmp, sizeof(Contact), 1, fp))
{
New_space(dire);
dire->directory[dire->contact_amount] = tmp;
//将文件中的联系人复制到顺序表相应位置
dire->contact_amount++;
}
HWND hwnd = GetHWnd();
MessageBox(hwnd, "通讯录初始化成功\n原通讯录加载成功", "初始化通讯录", MB_OKCANCEL);
}
void New_space(Dire* dire)
{
if (dire->capacity - 1 == dire->contact_amount)//如果容量已满
{
Contact* tmp = (Contact*)realloc(dire->directory, (dire->capacity + NEW_SIZE) * sizeof(Contact));
//给其分配新的空间
if (tmp == NULL)
{
HWND hwnd = GetHWnd();
MessageBox(hwnd, "内存拓展失败", "内存拓展", MB_OKCANCEL);
exit(0);
}
dire->directory = tmp;
dire->capacity = dire->capacity + NEW_SIZE;
}
}
void Input_message(Dire* dire)//信息录入功能
{
New_space(dire);
//为图形化录入设置画面
initgraph(800, 500);
setbkcolor(WHITE);
cleardevice();
loadimage(2);
setbkmode(TRANSPARENT);
settextcolor(BLACK);
settextstyle(50, 20, "楷体");
outtextxy(250, 230, "请");
outtextxy(250, 280, "输");
outtextxy(250, 330, "入");
outtextxy(250, 380, "信");
outtextxy(250, 430, "息");
setfillcolor(RGB(131, 98, 170));
fillrectangle(320, 240, 620, 270);
settextstyle(30, 20, "楷体");
settextcolor(RED);
outtextxy(340, 240, "输入姓名");
fillrectangle(320, 280, 620, 310);
settextstyle(30, 20, "楷体");
settextcolor(RED);
outtextxy(340, 280, "输入籍贯");
fillrectangle(320, 320, 620, 350);
settextstyle(30, 20, "楷体");
settextcolor(RED);
outtextxy(340, 320, "输入电话号码1");
fillrectangle(320, 360, 620, 390);
settextstyle(30, 20, "楷体");
settextcolor(RED);
outtextxy(340, 360, "输入电话号码2");
fillrectangle(320, 400, 620, 430);
settextstyle(30, 20, "楷体");
settextcolor(RED);
outtextxy(340, 400, "输入电子邮箱");
setfillcolor(GREEN);
fillrectangle(640, 400, 720, 450);
settextstyle(30, 20, "楷体");
settextcolor(BLACK);
outtextxy(640, 410, "确定");
int x = 0;
while (1)
{
MOUSEMSG msg = GetMouseMsg();
if (msg.x > 320 && msg.x < 620 && msg.y>240 && msg.y < 270)
{
setlinecolor(GREEN);
rectangle(320, 240, 620, 270);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_NAME] = { 0 };
InputBox(ss, MAX_NAME, "请输入姓名");
//outtextxy(500, 25, ss);
memcpy(dire->directory[dire->contact_amount].name, ss, MAX_NAME);
x++;
}
}
else if (msg.x > 320 && msg.x < 620 && msg.y>280 && msg.y < 310)
{
rectangle(320, 280, 620, 310);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_ADDRESS] = { 0 };
InputBox(ss, MAX_ADDRESS, "请输入籍贯");
//outtextxy(500, 25, ss);
memcpy(dire->directory[dire->contact_amount].address, ss, MAX_ADDRESS);
x++;
}
}
else if (msg.x > 320 && msg.x < 620 && msg.y>320 && msg.y < 350)
{
rectangle(320, 320, 620, 350);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_PHONENUM] = { 0 };
InputBox(ss, MAX_PHONENUM, "请输入电话号码1");
//outtextxy(500, 25, ss);
memcpy(dire->directory[dire->contact_amount].phone_number1, ss, MAX_PHONENUM);
x++;
}
}
else if (msg.x > 320 && msg.x < 620 && msg.y>360 && msg.y < 390)
{
rectangle(320, 360, 620, 390);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_PHONENUM] = { 0 };
InputBox(ss, MAX_PHONENUM, "请输入电话号码2");
//outtextxy(500, 25, ss);
memcpy(dire->directory[dire->contact_amount].phone_number2, ss, MAX_PHONENUM);
x++;
}
}
else if (msg.x > 320 && msg.x < 620 && msg.y>400 && msg.y < 430)
{
rectangle(320, 400, 620, 430);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_ELECMAILBOX] = { 0 };
InputBox(ss, MAX_ELECMAILBOX, "请输入电子邮箱");
//outtextxy(500, 25, ss);
memcpy(dire->directory[dire->contact_amount].elec_mailbox, ss, MAX_ELECMAILBOX);
x++;
}
}
else if (msg.x > 640 && msg.x < 720 && msg.y>400 && msg.y < 450)
{
setfillcolor(BLACK);
rectangle(640, 400, 720, 450);
if (msg.uMsg == WM_LBUTTONDOWN)
{
goto mm;
}
}
}
mm:;
if (x >= 5)
{
dire->contact_amount++;
HWND hwnd = GetHWnd();
MessageBox(hwnd, "联系人添加成功", "新建联系人", MB_OKCANCEL);
}
else
{
HWND hwnd = GetHWnd();
MessageBox(hwnd, "联系人添加失败", "新建联系人", MB_OKCANCEL);
return;
}
}
//
//
void Browse_message(const Dire* dire)//信息浏览
{
putchar('\n');
putchar('\n');
printf("当前通讯录信息如下\n\n");
for (int i = dire->contact_amount - 1; i >= 0; i--)
{
//在控制台打印所有联系人信息
printf("姓名: ");
printf("%s\n", (dire->directory + i)->name);
printf("籍贯: ");
printf("%s\n", (dire->directory + i)->address);
printf("电话号码1: ");
printf("%s\n", (dire->directory + i)->phone_number1);
printf("电话号码2: ");
printf("%s\n", (dire->directory + i)->phone_number2);
printf("电子邮箱: ");
printf("%s\n", (dire->directory + i)->elec_mailbox);
putchar('\n');
putchar('\n');
}
}
void Check_message(Dire* dire)//信息查询功能(根据联系人姓名)
{
int flag = 0;
initgraph(500, 500);
setbkcolor(GREEN);
cleardevice();
int i = 0;
char str[MAX_NAME] = { 0 };
setbkmode(TRANSPARENT);
InputBox(str, MAX_NAME, "请输入联系人姓名");
settextstyle(30, 0, "宋体");
settextcolor(BLACK);
for (i = dire->contact_amount - 1; i >= 0; i--)
{
if (memcmp(str, (dire->directory + i)->name, MAX_NAME) == 0)//若满足字符串相等,就找到该联系人
{
flag = 1;
Contact ss = dire->directory[i];
outtextxy(50, 0, "查询联系人信息如下");
outtextxy(50, 50, "姓名:");
outtextxy(50, 100, "籍贯:");
outtextxy(50, 150, "电话号码1:");
outtextxy(50, 200, "电话号码2:");
outtextxy(50, 250, "电子邮箱:");
settextcolor(RED);
fillrectangle(75, 300, 150, 330);
outtextxy(75, 300, "确认");
outtextxy(150, 50, ss.name);
outtextxy(150, 100, ss.address);
outtextxy(200, 150, ss.phone_number1);
outtextxy(200, 200, ss.phone_number2);
outtextxy(200, 250, ss.elec_mailbox);
while (1)
{
MOUSEMSG msg = GetMouseMsg();
if (msg.x > 75 && msg.x < 150 && msg.y>300 && msg.y < 330)
{
setlinecolor(BLACK);
rectangle(75, 300, 150, 330);
if (msg.uMsg == WM_LBUTTONDOWN)
{
return;
}
}
}
}
}
if (flag == 0)
{
HWND hwnd = GetHWnd();
MessageBox(hwnd, "通讯录查无此人", "查询联系人", MB_OKCANCEL);
}
}
void Redact_message(Dire* dire)//信息修改功能
{
char str[MAX_NAME] = { 0 };
InputBox(str, MAX_NAME, "请输入姓名");
int i = 0;
for (i = dire->contact_amount - 1; i >= 0; i--)
{
if (memcmp(str, (dire->directory + i)->name, MAX_NAME) == 0)//若满足字符串相等,就找到该联系人
{
//设计信息修改界面
initgraph(800, 500);
setbkcolor(RGB(72, 29, 54));
cleardevice();
settextstyle(40, 0, "宋体");
settextcolor(BLACK);
setfillcolor(RED);
outtextxy(240, 20, "请选择修改信息");
fillrectangle(250, 100, 350, 150);
fillrectangle(400, 100, 500, 150);
fillrectangle(250, 180, 350, 230);
fillrectangle(400, 180, 500, 230);
fillrectangle(250, 250, 350, 300);
setfillcolor(GREEN);
fillrectangle(400, 250, 500, 300);
setbkmode(TRANSPARENT);
outtextxy(250, 100, "姓名");
outtextxy(400, 100, "籍贯");
outtextxy(250, 180, "号码1");
outtextxy(400, 180, "号码2");
outtextxy(250, 250, "邮箱");
outtextxy(400, 250, "确认");
break;
}
}
while (1)//根据鼠标现在需要修改的信息,点击确定退出修改
{
MOUSEMSG msg = GetMouseMsg();
if (msg.x > 250 && msg.x < 350 && msg.y>100 && msg.y < 150)
{
setlinecolor(BLACK);
rectangle(250, 100, 350, 150);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_NAME] = { 0 };
InputBox(ss, MAX_NAME, "请输入修改姓名");
outtextxy(500, 25, ss);
memcpy(dire->directory[i].name, ss, MAX_NAME);
}
}
else if (msg.x > 400 && msg.x < 500 && msg.y>100 && msg.y < 150)
{
rectangle(400, 100, 500, 150);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_ADDRESS] = { 0 };
InputBox(ss, MAX_ADDRESS, "请输入籍贯");
outtextxy(500, 25, ss);
memcpy(dire->directory[i].address, ss, MAX_ADDRESS);
}
}
else if (msg.x > 250 && msg.x < 350 && msg.y>180 && msg.y < 230)
{
rectangle(250, 180, 350, 230);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_PHONENUM] = { 0 };
InputBox(ss, MAX_PHONENUM, "请输入电话号码1");
outtextxy(500, 25, ss);
memcpy(dire->directory[i].phone_number1, ss, MAX_PHONENUM);
}
}
else if (msg.x > 400 && msg.x < 500 && msg.y>180 && msg.y < 230)
{
rectangle(400, 180, 500, 230);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_PHONENUM] = { 0 };
InputBox(ss, MAX_PHONENUM, "请输入电话号码1");
outtextxy(500, 25, ss);
memcpy(dire->directory[i].phone_number2, ss, MAX_PHONENUM);
}
}
else if (msg.x > 250 && msg.x < 350 && msg.y>250 && msg.y < 300)
{
rectangle(250, 250, 350, 300);
if (msg.uMsg == WM_LBUTTONDOWN)
{
char ss[MAX_ELECMAILBOX] = { 0 };
InputBox(ss, MAX_ELECMAILBOX, "请输入电子邮箱");
outtextxy(500, 25, ss);
memcpy(dire->directory[i].elec_mailbox, ss, MAX_ELECMAILBOX);
}
}
else if (msg.x > 400 && msg.x < 500 && msg.y>250 && msg.y < 300)
{
rectangle(400, 250, 500, 300);
if (msg.uMsg == WM_LBUTTONDOWN)
{
HWND hwnd = GetHWnd();
MessageBox(hwnd, "信息修改成功", "修改联系人", MB_OKCANCEL);
return;
}
}
}
}
void Save_Directory(Dire* dire)
{
FILE* pf = fopen("Directory.txt", "wb");//以二进制只写的方式打开文件
if (!pf)//若打开失败,退出程序
{
HWND hwnd = GetHWnd();
MessageBox(hwnd, "打开失败", "保存通讯录", MB_OKCANCEL);
exit(0);
}
for (int i = 0; i < dire->contact_amount; i++)
{
fwrite(&(dire->directory[i]), sizeof(Contact), 1, pf);//依次将信息写入
}
fclose(pf);//写完就关闭文件
pf = NULL;//置为NULL
HWND hwnd = GetHWnd();
MessageBox(hwnd, "保存成功", "保存通讯录", MB_OKCANCEL);
}
void Destory(Dire* dire)//销毁通讯录动态开辟的空间
{
free(dire->directory);
dire->directory = NULL;
dire->capacity = 0;
dire->contact_amount = 0;
}
//test.cpp 调用所有函数的mian函数
#define _CRT_SECURE_NO_WARNINGS 1
#include"directory.h"
int main()
{
Welcome();//负责全局调用函数的主函数
return 0;
}