diff --git a/README.md b/README.md index c826b77..de4e8f0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,265 @@ -# address-book-management-system +# 基于C++的通讯录系统的设计与实现 -基于C++的通讯录系统的设计与实现 \ No newline at end of file +# 一 需求分析 + +通讯录系统可帮助使用者管理归纳通讯录名单,达到添加,删除,修改,保存等需求。 + +# 二 系统设计 + +## 2.1 **功能模块设计** + +**通讯录主要功能为:**添加通讯录成员,修改成员,删除成员,按需求搜索查看成员,保存为文档。 + +如下图所示: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/bc5ec8765192d2e34a411ca325319160.writebug) + +**系统各模块的功能具体描述为:** + +**1**、添加成员模块 + +提供界面让使用者输入希望加入的通讯录成员的各类信息(姓名,电话,住址, QQ,邮箱等),并检查格式是否有误。若格式无误,则将该通讯录信息通过二进制文件方式储存在./contact文件目录下。 + +**2**、修改成员模块 + +使用者可以重写已有的通讯录成员,增加或删除除姓名以外的各个信息。一条通 讯录成员可以拥有多个电话号码或QQ。 + +**3**、删除成员模块 + +使用者可以选择某个不希望继续使用的通讯录成员并删除他们。 + +**4**、搜索查看成员模块 + +使用者通过各种方式查询已添加的通讯录成员,并决定是否修改或删除它们。提供的方法有:精准查询,模糊查询,按分类查询等。 + +## 2.2 系统架构设计 + +系统开发使用Template Method设计模式和Strategy Patten 两种设计模式,较好的封装所需函数,使得主程序入口开发环节只需关注Contact.h头文件即可实现。 + +具体类之间的耦合关系见下图: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/a203ff3046cc160d1b971568683ffd63.writebug) + + + +**类的关系设计如下图所示:** + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/db7ed97700697f6e106a4f72e6346ffc.writebug) + +**各类的具体功能和说明如下:** + +- class Person; 提供基本的数据存储结构 + +- classContactInterface; 提供主函数菜单,策略选择方法。是Contact类的一个接口,MainStrategy的调用者 + +- classContactInit; 提供初始化程序所需函数。同样是Contact类的一个接口 + +- classContact; 具体实现了两个接口的方法。MainStrategy的决策者。同时面向调用者(main.cpp)。但注意Contact不提供任何public方法。需要通过两个接口调用 + +- classCheckInterface; 提供检查函数 + +- classMainStrategy; Strategy Patten设计模式。同时包含子类公用的方法 + +- classMainNewMenu; class MainDelMenu; class MainMdfMenu; **分别override **doMainStrategy()函数,实现新建,删除,修改功能 + +- classMainVewMenuInterface; **override **doMainStrategy()函数,ViewStrategy的调用者 + +- classMainVewMenu; ViewStrategy的决策者 + +- class ViewStrategy; StrategyPatten + +- classViewAllMenu; class ViewExactMenu; + +**class ViewFuzzyMenu; class ViewCategoryMenu; **分别override **doViewStrategy()**函数,实现所有查找,精确查找,模糊查找,按类查找功能。 + +# 三 系统实现 + +## 3.1 系统实现流程 + + 通讯录系统实现流程如下图所示: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/5bdb36bb9f84f408f3aff113738b297a.writebug) + +## 3.2 类的实现 + + 系统包含Person,Contact, ContactInterface, ContactInit等类,具体类结构声明如下: + + **Person**类: + +```c++ +class Person +{ +Public: + char name[MAXNAME]; + char sex; + char tel[MAXTEL]; + char addr[MAXADDR]; + char zip[MAXZIP]; + char mail[MAXMAIL]; + char qq[MAXQQ]; + char category[MAXCTGY]; + + Person(); + ~Person(); +}; + +``` + + **ContactInterface**类: + +```c++ +class CheckInterface +{ +public: + bool check(Person&, const bool _check_repe) const; + bool check_exact(const Person&, const string) const; +virtual ~CheckInterface(){}; +private: + vector part_tq(const Person&, const char* const) const; +}; + +``` + + **ContactInit**类: + +```c++ +class ContactInit +{ +public: + virtual int refresh() const = 0; + virtual void welcome() const= 0; + virtual ~ContactInit(){}; +}; + +``` + + **Contact**类: + +```c++ +class Contact : public ContactInterface, public ContactInit +{ +private: + MainStrategy* setMainStrategy(int); +public: + Contact(); + ~Contact(); + int refresh() const; + void welcome() const; +}; + +``` + +**MainStrategy**类: + +```c++ +class MainStrategy : public CheckInterface +{ +public: + MainStrategy(); + virtual ~MainStrategy(); + virtual int doMainStrategy() = 0; +protected: + void printAll() const; + void print_prsn(const Person&, const string, bool) const; + + bool delete_prsn(Person&) const; + int modify_prsn(Person&) const; //Way to modify a spefic Person member, with 0->success, -1->fail +}; + +``` + + **MainViewMenuInterface**类: + +```c++ +class MainVewMenuInterface : public MainStrategy +{ +public: +private: + ViewStrategy* viewStrategy; + virtual ViewStrategy* setViewStrategy(int) = 0; + virtual int view(Person* v_Person) const; +public: + MainVewMenuInterface(); + virtual ~MainVewMenuInterface(); + virtual int doMainStrategy(); +}; + +``` + +# 四 系统测试 + +## 4.1 登录界面 + +系统运行开始的界面如图所示: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/32dbe51ca9ec80a24acaf075328f0d88.writebug) + +主要通过选择结构和循环结构实现界面的前进和后退。例如,第一个登录界面出现5个选择:1.新建,2.删除,3.修改,4.浏览,5.退出 + +## 4.2 添加联系人 + +在开始界面输入“1”即添加新的成员: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/3daf468c06b3014d605f10ec00365ebe.writebug) + + 若显示 Information Entry Success! 则录入数据成功。若显示Information Error! 则录入数据失败。如图则因为在电话(TEL)中出现了中文字符。随后将返回主界面。 + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/fe23be738be6c25fadf86502f96ea086.writebug) + +## 4.3 删除联系人 + +在主界面输入2可删除成员: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/e6c9d2abdbec776664748b61fbff9f9f.writebug) + +如我们希望删除(2)数据,则键入2: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/a9e40e12e21a997342a33c55b0fe34d0.writebug) + +就可以得到(2)的详细数据。输入y/n即可选择是否删除该成员。随后程序将返回主界面。 + +## 4.4 修改联系人 + +在主界面下输入3可以修改已有的成员:我们希望修改刚刚加入的成员(1)的电话号码,同时加入他所有常用的QQ号码: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/22cda86e3b5dd5bce444b94980e3bc54.writebug) + +键入1, 可修改第一个人的信息,并按照需求修改信息: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/c1775a7e9a2c6fccf937f8a0b0858f0d.writebug) + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/68481038dfb78a97894e0f0b21abdf82.writebug) + +确认无误后即可修改信息,随后返回主界面。 + +## 4.4 搜索联系人 + +输入4即可按需求分类查看搜索成员: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/483615b4dc7d81f9a00b9aa623108fd0.writebug) + +键入1进行精准匹配,该模式下只匹配名字:如输入“严恩伟”后匹配信息如图: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/c6d8d639c5f8e2d9fdc402b98bcabd29.writebug) + +随后可以根据自身需求选择1-3选项。此处不再演示。 + +在view模式下键入2进行模糊匹配,该模式匹配名字,电话,地址。只要出现匹配字符即给与显示。如输入“181”后显示: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/f97505b0dc12dcd8e79ea14b481cbc0f.writebug) + +选择1-3即可进入其详细页面。此处不再演示。 + +在view模式下键入3进行分类(category)匹配。该模式会列出所有的分类,并可根据用户选择的分类进行罗列(其中未设置的分类被标记为Unset): + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/ecf4c1f266c330014fc34ffbdf9086bf.writebug) + +根据提示选择1-2即可进入相应页面。选择0即可退出。 + +在view模式下键入4进行全局匹配。该模式会列出所有的成员: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/b49f90fdd2d7887d5d1e1251d2001d06.writebug) + +在view模式下键入5退出view模式。 + +在主菜单中键入5退出程序。 \ No newline at end of file diff --git a/src/C++程序设计课程设计.doc b/src/C++程序设计课程设计.doc new file mode 100644 index 0000000..b713aa4 Binary files /dev/null and b/src/C++程序设计课程设计.doc differ diff --git a/src/CheckInterface.cpp b/src/CheckInterface.cpp new file mode 100644 index 0000000..bacc06d --- /dev/null +++ b/src/CheckInterface.cpp @@ -0,0 +1,145 @@ +// CheckInterface.cpp: implementation of the CheckInterface class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "CheckInterface.h" + + +bool CheckInterface::check(Person& person, const bool _check_repe) const { + int i = 0, j = 0; //common loop variable + string re_write = ""; //rewrite tel and qq(if valid) into good format + vector temp_str; + bool mailFlag = false; //check mailbox's format +//=============================== + + if (!((strlen(person.name)>0) && (strlen(person.tel)>0) && (strlen(person.addr)>0)) ){ + errorMsg = "Name/Tel/Address is null."; + return false; + } +//=============================== + + if (_check_repe){ //here to use _check_repe only once. + for (i = 0; i < contact_item.size(); i++) + if (strcmp(person.name,&*contact_item[i]->name) == 0){ + sizeof(*contact_item[i]); + errorMsg = "Item already exists."; + return false; + } + } +//=============================== + + for (i = 0; i='0')&&(person.tel[i]<='9') ) || (person.tel[i] == ','))){ + errorMsg = "Unknown character in Tel option."; + return false; + } + } + temp_str = this->part_tq(person, "tel"); + re_write = ""; + for (i = 0; i='0')&&(person.qq[i]<='9') ) || (person.qq[i] == ','))){ + errorMsg = "Unknown character in QQ option."; + return false; + } + temp_str.clear(); + temp_str = this->part_tq(person, "qq"); + for (i = 0; i temp_vec = part_tq(index, "tel"); + for (int i = 0; i CheckInterface::part_tq(const Person& person, const char* const TEL_QQ) const { + vector rtn_vec; + string src_str; + string temp_str = ""; + if (strcmp(TEL_QQ,"tel") == 0) + src_str = person.tel; + else if (strcmp(TEL_QQ,"qq") == 0) + src_str = person.qq; + else + return rtn_vec; + + for (int i = 0; i 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Person.h" + +class CheckInterface +{ +private: + vector part_tq(const Person&, const char* const) const; +public: + virtual ~CheckInterface(){}; + bool check(Person&, const bool _check_repe) const; + bool check_exact(const Person&, const string) const; //check if index.name == info_str +}; + +#endif // !defined(AFX_CHECKINTERFACE_H__ABFADC84_DBE2_4985_9360_97CF317116D0__INCLUDED_) diff --git a/src/Contact.cpp b/src/Contact.cpp new file mode 100644 index 0000000..1fbab2e --- /dev/null +++ b/src/Contact.cpp @@ -0,0 +1,108 @@ + +#include "stdafx.h" +#include "Contact.h" + +extern vector contact_item; +extern string errorMsg; + +Contact::Contact() +{ + MainFunctionsNum = 5; + refresh(); +} + +Contact::~Contact() +{ + int freei = contact_item.size(); + for (int i = 0; i 0){ + cout<<"\t"<name; + info_check += ".ctt"; + if (info_check == fileinfo.name) + contact_item.push_back(temp_p); + } + + } while (_findnext(hFile, &fileinfo) == 0); + _findclose(hFile); + } + else{ + if (!CreateDirectory(dir, NULL)) return -1; + } + return contact_item.size(); +} + diff --git a/src/Contact.h b/src/Contact.h new file mode 100644 index 0000000..c861b33 --- /dev/null +++ b/src/Contact.h @@ -0,0 +1,33 @@ +// Contact.h: Application Library +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_Contact_H__578FBE4B_85A0_4A32_B651_7CF4D553E488__INCLUDED_) +#define AFX_Contact_H__578FBE4B_85A0_4A32_B651_7CF4D553E488__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +#include "ContactInterface.h" +#include "ContactInit.h" +#include "MainNewMenu.h" +#include "MainDelMenu.h" +#include "MainMdfMenu.h" +#include "MainVewMenu.h" + + +class Contact : public ContactInterface, public ContactInit +{ +private: + MainStrategy* setMainStrategy(int); //override from ContactInterface + void removeMainStrategy(void*); //... + int refresh() const; //override from ContactInit + void welcome() const; //... +public: + Contact(); + ~Contact(); +}; + +#endif // !defined(AFX_Contact_H__578FBE4B_85A0_4A32_B651_7CF4D553E488__INCLUDED_) diff --git a/src/ContactInit.h b/src/ContactInit.h new file mode 100644 index 0000000..b14a1fe --- /dev/null +++ b/src/ContactInit.h @@ -0,0 +1,20 @@ +// ContactInit.h: Frame Gallary +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CONTACTINIT_H__5C8BC83A_4BE8_4C6A_A36F_6CF4CC06AA7B__INCLUDED_) +#define AFX_CONTACTINIT_H__5C8BC83A_4BE8_4C6A_A36F_6CF4CC06AA7B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class ContactInit +{ +public: + virtual ~ContactInit(){}; + virtual int refresh() const = 0; + virtual void welcome() const= 0; +}; + +#endif // !defined(AFX_CONTACTINIT_H__5C8BC83A_4BE8_4C6A_A36F_6CF4CC06AA7B__INCLUDED_) diff --git a/src/ContactInterface.cpp b/src/ContactInterface.cpp new file mode 100644 index 0000000..2255a3c --- /dev/null +++ b/src/ContactInterface.cpp @@ -0,0 +1,32 @@ + +#include "stdafx.h" +#include "ContactInterface.h" + +extern vector contact_item; +extern string errorMsg; + +int ContactInterface::main_menu(){ + char rtn_int; + int fuckin_stupid = 0; + cin.clear(); + cin.sync(); + do{ + system("cls"); + readFile(".\\io\\MainMenu.io"); + if (fuckin_stupid != 0) + cout<<"\t\tError Inputing!\n"; + cout<<"\tEnter number[1-"<'0' + MainFunctionsNum)); + + mainStrategy = setMainStrategy(rtn_int-'0'); + if (mainStrategy == NULL){ + return -1; + } + mainStrategy->doMainStrategy(); + removeMainStrategy(mainStrategy); + return 0; +} diff --git a/src/ContactInterface.h b/src/ContactInterface.h new file mode 100644 index 0000000..00ef27b --- /dev/null +++ b/src/ContactInterface.h @@ -0,0 +1,29 @@ +// ContactInterface.h: Frame Gallary +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CONTACTINTERFACE_H__61397655_84DB_48A0_A5E4_041E75321807__INCLUDED_) +#define AFX_CONTACTINTERFACE_H__61397655_84DB_48A0_A5E4_041E75321807__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MainStrategy.h" +#include "CheckInterface.h" +#include "PrtMenuInterface.h" + +class ContactInterface : public PrtMenuInterface +{ +private: + MainStrategy* mainStrategy; + virtual MainStrategy* setMainStrategy(int) = 0; + virtual void removeMainStrategy(void*) = 0; +protected: + int MainFunctionsNum; +public: + int main_menu(); + virtual ~ContactInterface(){}; +}; + +#endif // !defined(AFX_CONTACTINTERFACE_H__61397655_84DB_48A0_A5E4_041E75321807__INCLUDED_) diff --git a/src/MainDelMenu.cpp b/src/MainDelMenu.cpp new file mode 100644 index 0000000..8d4e182 --- /dev/null +++ b/src/MainDelMenu.cpp @@ -0,0 +1,41 @@ +// MainDelMenu.cpp: implementation of the MainDelMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "MainDelMenu.h" + +MainDelMenu::doMainStrategy() +{ + int num = contact_item.size(); + int index = 0; + string addr = ".\\contact\\"; + system("cls"); + cout< 1){ + printAll(); + cout<<"\n\tEnter the INDEX(1 - "<>index; + if ((index<0) || (index>num)){ + cout<<"\n\n\t\tError Input!\n"; + cin.clear(); + cin.sync(); + getch(); + index = 0; + } + } + else if ( num == 1) + index = 1; + if (index == 0) + return 0; + index--; + print_prsn(*contact_item[index],"=====Delete Contact====================\n",true); + delete_prsn(*contact_item[index]); + cin.clear(); + cin.sync(); + getchar(); + return 0; +} \ No newline at end of file diff --git a/src/MainDelMenu.h b/src/MainDelMenu.h new file mode 100644 index 0000000..f24c976 --- /dev/null +++ b/src/MainDelMenu.h @@ -0,0 +1,21 @@ +// MainDelMenu.h: Application Library +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINDELMENU_H__59F8280E_220C_4D11_9B6E_96B22BB96034__INCLUDED_) +#define AFX_MAINDELMENU_H__59F8280E_220C_4D11_9B6E_96B22BB96034__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MainStrategy.h" + +class MainDelMenu : public MainStrategy +{ +public: + virtual ~MainDelMenu(){}; + int doMainStrategy(); +}; + +#endif // !defined(AFX_MAINDELMENU_H__59F8280E_220C_4D11_9B6E_96B22BB96034__INCLUDED_) diff --git a/src/MainMdfMenu.cpp b/src/MainMdfMenu.cpp new file mode 100644 index 0000000..e97d34c --- /dev/null +++ b/src/MainMdfMenu.cpp @@ -0,0 +1,41 @@ +// MainMdfMenu.cpp: implementation of the MainMdfMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "MainMdfMenu.h" + +MainMdfMenu::doMainStrategy() +{ + int num = contact_item.size(); + int index = 0; + + system("cls"); + cout< 1){ + printAll(); + cout<<"\n\tEnter the INDEX(1 - "<>index; + if ( (index<0) || (index>num) ){ + cout<<"\n\t\tError Input!\n"; + cin.clear(); + cin.sync(); + getch(); + index = 0; + } + } + else if ( num == 1) + index = 1; + if (index == 0) + return 0; + index--; + + modify_prsn(*contact_item.at(index)); + cin.clear(); + cin.sync(); + getch(); + return 0; +} \ No newline at end of file diff --git a/src/MainMdfMenu.h b/src/MainMdfMenu.h new file mode 100644 index 0000000..eb1decb --- /dev/null +++ b/src/MainMdfMenu.h @@ -0,0 +1,21 @@ +// MainMdfMenu.h: Application Library +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINMDFMENU_H__4AF95322_636F_4CB7_B574_C8FB878AFB87__INCLUDED_) +#define AFX_MAINMDFMENU_H__4AF95322_636F_4CB7_B574_C8FB878AFB87__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MainStrategy.h" + +class MainMdfMenu : public MainStrategy +{ +public: + virtual ~MainMdfMenu(){}; + int doMainStrategy(); +}; + +#endif // !defined(AFX_MAINMDFMENU_H__4AF95322_636F_4CB7_B574_C8FB878AFB87__INCLUDED_) diff --git a/src/MainNewMenu.cpp b/src/MainNewMenu.cpp new file mode 100644 index 0000000..539214b --- /dev/null +++ b/src/MainNewMenu.cpp @@ -0,0 +1,107 @@ +// MainNewMenu.cpp: implementation of the MainNewMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "MainNewMenu.h" + +MainNewMenu::doMainStrategy() +{ + system("cls"); + cout<>t_info.name; + cout<<"Address:"; + cin.clear(); + cin.sync(); + cin>>t_info.addr; + cout<<"*Tel:"; + cin.clear(); + cin.sync(); + cin>>t_info.tel; + + char t_c; + cout<<"\n\tthe following data can be set as NULL.Press ENTER to skip\n\n"; + + cin.clear(); + cin.sync(); + + cout<<"Gender:(M for Male, F for Female)"; + char _c= getchar(); + if (_c != '\n') + t_info.sex = _c; + cin.clear(); + cin.sync(); + + cout<<"Zip:"; + while((t_c = getchar()) != '\n'){ + t_str += t_c; + } + strcpy(t_info.zip,t_str.c_str()); + + cin.clear(); + cin.sync(); + t_str = ""; + + cout<<"Mailbox:"; + while((t_c = getchar()) != '\n'){ + t_str += t_c; + } + strcpy(t_info.mail,t_str.c_str()); + cin.clear(); + cin.sync(); + t_str = ""; + + cout<<"*QQ:"; + while((t_c = getchar()) != '\n'){ + t_str += t_c; + } + strcpy(t_info.qq, t_str.c_str()); + cin.clear(); + cin.sync(); + t_str = ""; + + cout<<"Category:"; + while((t_c = getchar()) != '\n'){ + t_str += t_c; + } + strcpy(t_info.category,t_str.c_str()); + cin.clear(); + cin.sync(); + t_str = ""; + + if(!check(t_info, true) ){ + cout<<"\n\t\t"< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MainStrategy.h" + +class MainNewMenu : public MainStrategy +{ +private: + bool create() const; +public: + virtual ~MainNewMenu(){}; + int doMainStrategy(); +}; + +#endif // !defined(AFX_MAINNEWMENU_H__FAE001ED_B300_4102_8F33_09E79DFDAEA6__INCLUDED_) diff --git a/src/MainStrategy.cpp b/src/MainStrategy.cpp new file mode 100644 index 0000000..88ebc63 --- /dev/null +++ b/src/MainStrategy.cpp @@ -0,0 +1,184 @@ +// MainStrategy.cpp: implementation of the MainStrategy class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "MainStrategy.h" + +void MainStrategy::print_prsn(const Person& prt_Person, const string info, bool refresh) const{ + system("cls"); + cout<name<<" TEL: "<<&*contact_item[i]->tel<<" ADDR: "<<&*contact_item[i]->addr<print_prsn(t_info,"=====Modify Contact====================\n",true); + cout<<"\n\n\t\tReally want to modify?[y/n]: "; + cin.clear(); + cin.sync(); + y_n = getch(); + if ((y_n == 'y') || (y_n == 'Y')){ + if(!check(t_info, false) ){ + cout<<"\n\t\tInfomation Error!"; + return false; + } + else{ + FILE *fp = fopen(addr.c_str(),"wb+"); + if (fp == NULL ){ + cout<<"\n\t\tError opening file!\n"; + return false; + } + else + if (fwrite(&t_info,sizeof(Person), 1, fp) != 1){ + cout<<"\n\t\tError writing to file!\n"; + return false; + } + else{ + cout<<"\n\t\tModify succeed!\n"; + fclose(fp); + } + } + } + else + cout<<"\n\t\tCanceled!\n"; + return true; +} \ No newline at end of file diff --git a/src/MainStrategy.h b/src/MainStrategy.h new file mode 100644 index 0000000..d8baa9b --- /dev/null +++ b/src/MainStrategy.h @@ -0,0 +1,28 @@ +// MainStrategy.h: Frame Gallary +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINSTRATEGY_H__EC9C2730_7A1B_40AF_AB90_CC8AC25EC1B5__INCLUDED_) +#define AFX_MAINSTRATEGY_H__EC9C2730_7A1B_40AF_AB90_CC8AC25EC1B5__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "CheckInterface.h" + +class MainStrategy : public CheckInterface +{ +public: + virtual ~MainStrategy(){}; + virtual int doMainStrategy() = 0; +protected: + void printAll() const; + void print_prsn(const Person&, const string, bool) const; + bool delete_prsn(Person&) const; + bool modify_prsn(Person&) const; //Way to modify a spefic Person member +}; + +//extern vector contact_item; + +#endif // !defined(AFX_MAINSTRATEGY_H__EC9C2730_7A1B_40AF_AB90_CC8AC25EC1B5__INCLUDED_) diff --git a/src/MainTestMenu.cpp b/src/MainTestMenu.cpp new file mode 100644 index 0000000..f49003b --- /dev/null +++ b/src/MainTestMenu.cpp @@ -0,0 +1,20 @@ +// MainTestMenu.cpp: implementation of the MainTestMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "MainTestMenu.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +MainTestMenu::MainTestMenu() +{ + +} + +MainTestMenu::~MainTestMenu() +{ + +} diff --git a/src/MainTestMenu.h b/src/MainTestMenu.h new file mode 100644 index 0000000..b6d67dc --- /dev/null +++ b/src/MainTestMenu.h @@ -0,0 +1,26 @@ +// MainTestMenu.h: interface for the MainTestMenu class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINTESTMENU_H__4F0A9680_D41C_411A_B456_680B37EB8308__INCLUDED_) +#define AFX_MAINTESTMENU_H__4F0A9680_D41C_411A_B456_680B37EB8308__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MainStrategy.h" + +class MainTestMenu : public MainStrategy +{ +public: + MainTestMenu(); + virtual ~MainTestMenu(); + virtual int doMainStrategy(){ + cout<<"test!\n"; + getch(); + return 0; + } +}; + +#endif // !defined(AFX_MAINTESTMENU_H__4F0A9680_D41C_411A_B456_680B37EB8308__INCLUDED_) diff --git a/src/MainVewMenu.cpp b/src/MainVewMenu.cpp new file mode 100644 index 0000000..59327b1 --- /dev/null +++ b/src/MainVewMenu.cpp @@ -0,0 +1,32 @@ +// MainVewMenu.cpp: implementation of the MainVewMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "MainVewMenu.h" + +MainVewMenu::MainVewMenu(){ + ViewFunctionsNum = 5; +} + +ViewStrategy* MainVewMenu::setViewStrategy(int slct_num){ + + switch(slct_num){ + case 1: + return new ViewExactMenu(); + case 2: + return new ViewFuzzyMenu(); + case 3: + return new ViewCategoryMenu(); + case 4: + return new ViewAllMenu(); + case 5: + break; + } + return NULL; +} + +void MainVewMenu::removeViewStrategy(void* p){ + delete p; +} + diff --git a/src/MainVewMenu.h b/src/MainVewMenu.h new file mode 100644 index 0000000..42d9569 --- /dev/null +++ b/src/MainVewMenu.h @@ -0,0 +1,29 @@ +// MainVewMenu.h: Application Library +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINVEWMENU_H__30EDC353_618B_4196_A8BB_4A59557068CD__INCLUDED_) +#define AFX_MAINVEWMENU_H__30EDC353_618B_4196_A8BB_4A59557068CD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MainVewMenuInterface.h" + +#include "ViewExactMenu.h" +#include "ViewAllMenu.h" +#include "ViewCategoryMenu.h" +#include "ViewFuzzyMenu.h" + +class MainVewMenu : public MainVewMenuInterface +{ +private: + ViewStrategy* setViewStrategy(int); + void removeViewStrategy(void*); +public: + MainVewMenu(); + virtual ~MainVewMenu(){}; +}; + +#endif // !defined(AFX_MAINVEWMENU_H__30EDC353_618B_4196_A8BB_4A59557068CD__INCLUDED_) diff --git a/src/MainVewMenuInterface.cpp b/src/MainVewMenuInterface.cpp new file mode 100644 index 0000000..2629d8a --- /dev/null +++ b/src/MainVewMenuInterface.cpp @@ -0,0 +1,84 @@ +// MainVewMenuInterface.cpp: implementation of the MainVewMenuInterface class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "MainVewMenuInterface.h" + +void sleep(){ + Sleep(20); + return; +} + +int MainVewMenuInterface::view(Person* v_Person) const{ + if (v_Person == NULL) + return -1; + bool refresh = true; + string addr = ".\\contact\\"; + int fuckin_stupid = 0; + int slct_num = 0; + do{ + print_prsn(*v_Person,"=====VIEW Contact====================\n",refresh); + if (refresh){ + readFile(".\\io\\View.io",sleep); + } + else{ + readFile(".\\io\\View.io"); + } + cin.clear(); + cin.sync(); + if (fuckin_stupid != 0) + cout<<"\t\tError Inputing!\n"; + cout<<"\tEnter number[1-3] to select the corresponding function: "; + cin.clear(); + cin.sync(); + slct_num = getch(); + fuckin_stupid++; + refresh = false; + }while((slct_num<'1') || (slct_num>'3')); + + switch (slct_num){ + case '1': + delete_prsn(*v_Person); + cin.clear(); + cin.sync(); + getch(); + break; + case '2': + modify_prsn(*v_Person); + cin.clear(); + cin.sync(); + getch(); + break; + case '3': + break; + } + return 0; +} + +int MainVewMenuInterface::doMainStrategy() +{ + int fuckin_stupid = 0; + char slct_num = 0; + do{ + system("cls"); + readFile(".\\io\\ViewMenu.io"); + + if (fuckin_stupid != 0) + cout<<"\t\tError Inputing!\n"; + cout<<"\tEnter number[1-"<'0' + ViewFunctionsNum)); + + viewStrategy = setViewStrategy(slct_num - '0'); + if (viewStrategy == NULL) + return -1; + view(viewStrategy->doViewStrategy()); + removeViewStrategy(viewStrategy); + return 0; +} + diff --git a/src/MainVewMenuInterface.h b/src/MainVewMenuInterface.h new file mode 100644 index 0000000..4d226cd --- /dev/null +++ b/src/MainVewMenuInterface.h @@ -0,0 +1,31 @@ +// MainVewMenuInterface.h: Frame Gallary +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINVEWMENUINTERFACE_H__7A32F346_890E_45E1_941B_4FC6A6A3714A__INCLUDED_) +#define AFX_MAINVEWMENUINTERFACE_H__7A32F346_890E_45E1_941B_4FC6A6A3714A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MainStrategy.h" +#include "ViewStrategy.h" +#include "PrtMenuInterface.h" + +class MainVewMenuInterface : public MainStrategy, public PrtMenuInterface +{ +private: + ViewStrategy* viewStrategy; + + virtual int view(Person* v_Person) const; //View a Person member with details + virtual ViewStrategy* setViewStrategy(int) = 0; + virtual void removeViewStrategy(void*) = 0; +protected: + int ViewFunctionsNum; +public: + virtual ~MainVewMenuInterface(){}; + int doMainStrategy(); +}; + +#endif // !defined(AFX_MAINVEWMENUINTERFACE_H__7A32F346_890E_45E1_941B_4FC6A6A3714A__INCLUDED_) diff --git a/src/Person.cpp b/src/Person.cpp new file mode 100644 index 0000000..58e5c37 --- /dev/null +++ b/src/Person.cpp @@ -0,0 +1,19 @@ + +#include "stdafx.h" +#include "Person.h" + +Person::Person() +{ + strcpy(this->addr,""); + strcpy(this->category,""); + strcpy(this->mail, ""); + strcpy(this->name, ""); + strcpy(this->qq, ""); + this->sex = '\0'; + strcpy(this->tel, ""); + strcpy(this->zip, ""); +} + +Person::~Person() +{ +} \ No newline at end of file diff --git a/src/Person.h b/src/Person.h new file mode 100644 index 0000000..4fb22a4 --- /dev/null +++ b/src/Person.h @@ -0,0 +1,38 @@ +// Person.h: Frame Gallary +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_Person_H__4EDC1B44_F6DC_404A_ADA9_E56095080841__INCLUDED_) +#define AFX_Person_H__4EDC1B44_F6DC_404A_ADA9_E56095080841__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define MAXNAME 100 +#define MAXTEL 80 +#define MAXADDR 100 +#define MAXZIP 10 +#define MAXMAIL 80 +#define MAXQQ 40 +#define MAXCTGY 20 + +class Person +{ +public: + Person(); + ~Person(); + char name[MAXNAME]; + char sex; + char tel[MAXTEL]; + char addr[MAXADDR]; + char zip[MAXZIP]; + char mail[MAXMAIL]; + char qq[MAXQQ]; + char category[MAXCTGY]; +}; + +extern vector contact_item; +extern string errorMsg; + +#endif // !defined(AFX_Person_H__4EDC1B44_F6DC_404A_ADA9_E56095080841__INCLUDED_) diff --git a/src/PrtMenuInterface.cpp b/src/PrtMenuInterface.cpp new file mode 100644 index 0000000..46f95b6 --- /dev/null +++ b/src/PrtMenuInterface.cpp @@ -0,0 +1,25 @@ +// PrtMenuInterface.cpp: implementation of the PrtMenuInterface class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "PrtMenuInterface.h" + +bool PrtMenuInterface::readFile(const char* file, void(*events)()) const{ + char line[1024]; + memset(line, 0, 1024); + FILE* fp = fopen(file,"r"); + if (fp == NULL){ + return false; + } + while(!feof(fp)){ + fgets(line, 1024, fp); + cout< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class PrtMenuInterface +{ +protected: + virtual bool readFile(const char*, void(*)() = NULL) const; +public: + virtual ~PrtMenuInterface(){}; +}; + +#endif // !defined(AFX_PRTMENUINTERFACE_H__77F54599_9711_43E8_97E8_278F62DD0880__INCLUDED_) diff --git a/src/StdAfx.cpp b/src/StdAfx.cpp new file mode 100644 index 0000000..078693b --- /dev/null +++ b/src/StdAfx.cpp @@ -0,0 +1,10 @@ +// stdafx.cpp : source file that includes just the standard includes +// contacts.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" +#include "Contact.h" +#include "Person.h" + +vector contact_item; +string errorMsg; \ No newline at end of file diff --git a/src/StdAfx.h b/src/StdAfx.h new file mode 100644 index 0000000..830e49d --- /dev/null +++ b/src/StdAfx.h @@ -0,0 +1,25 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__F5925CEB_85C9_4293_8D63_288D374D3EDC__INCLUDED_) +#define AFX_STDAFX_H__F5925CEB_85C9_4293_8D63_288D374D3EDC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#pragma warning(disable:4786) + +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +#endif // !defined(AFX_STDAFX_H__F5925CEB_85C9_4293_8D63_288D374D3EDC__INCLUDED_) diff --git a/src/ViewAllMenu.cpp b/src/ViewAllMenu.cpp new file mode 100644 index 0000000..f9de37c --- /dev/null +++ b/src/ViewAllMenu.cpp @@ -0,0 +1,21 @@ +// ViewAllMenu.cpp: implementation of the ViewAllMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ViewAllMenu.h" + +Person* ViewAllMenu::doViewStrategy(){ + int num = contact_item.size(); + int index = 0; + vector chosen_item; + + ViewStrategy::all_vew(); + + for (int i = 0;iname<<" TEL: "<<&*contact_item[i]->tel<<" ADDR: "<<&*contact_item[i]->addr< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ViewStrategy.h" + +class ViewAllMenu : public ViewStrategy +{ +public: + virtual ~ViewAllMenu(){}; + Person* doViewStrategy(); +}; + +#endif // !defined(AFX_VIEWALLMENU_H__8C79467E_E8F5_483F_8EBE_66DD4CE77A44__INCLUDED_) diff --git a/src/ViewCategoryMenu.cpp b/src/ViewCategoryMenu.cpp new file mode 100644 index 0000000..e1085e3 --- /dev/null +++ b/src/ViewCategoryMenu.cpp @@ -0,0 +1,22 @@ +// ViewCategoryMenu.cpp: implementation of the ViewCategoryMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ViewCategoryMenu.h" + +Person* ViewCategoryMenu::doViewStrategy(){ + string info_str = ViewStrategy::category_vew(); + int num = contact_item.size(); + int index = 0; + vector chosen_item; + + for (int i = 0; i < num; i++){ + if (strcmp(&*contact_item[i]->category,info_str.c_str()) == 0 ){ + chosen_item.push_back(i); + cout<<"("<name<<" TEL: "<<&*contact_item[i]->tel<<" ADDR: "<<&*contact_item[i]->addr< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ViewStrategy.h" + +class ViewCategoryMenu : public ViewStrategy +{ +public: + virtual ~ViewCategoryMenu(){}; + Person* doViewStrategy(); +}; + +#endif // !defined(AFX_VIEWCATEGORYMENU_H__48B023E6_1B4C_4082_A1E2_BB55EEC3B766__INCLUDED_) diff --git a/src/ViewExactMenu.cpp b/src/ViewExactMenu.cpp new file mode 100644 index 0000000..cc04e90 --- /dev/null +++ b/src/ViewExactMenu.cpp @@ -0,0 +1,22 @@ +// ViewExactMenu.cpp: implementation of the ViewExactMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ViewExactMenu.h" + +Person* ViewExactMenu::doViewStrategy(){ + string info_str = ViewStrategy::title_vew("=====Exact Query Contact===============", "\tEnter infomation that needs to be querying: "); + int num = contact_item.size(); + int index = 0; + vector chosen_item; + + for (int i = 0; i < num; i++){ + if ( check_exact(*contact_item[i], info_str)){ + chosen_item.push_back(i); + cout<<"("<name<<" TEL: "<<&*contact_item[i]->tel<<" ADDR: "<<&*contact_item[i]->addr< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ViewStrategy.h" + +class ViewExactMenu : public ViewStrategy +{ +public: + virtual ~ViewExactMenu(){}; + Person* doViewStrategy(); +}; + +#endif // !defined(AFX_VIEWEXACTMENU_H__33A9D84C_B321_4F0C_A59B_3777BF3AE004__INCLUDED_) diff --git a/src/ViewFuzzyMenu.cpp b/src/ViewFuzzyMenu.cpp new file mode 100644 index 0000000..87c0401 --- /dev/null +++ b/src/ViewFuzzyMenu.cpp @@ -0,0 +1,22 @@ +// ViewFuzzyMenu.cpp: implementation of the ViewFuzzyMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ViewFuzzyMenu.h" + +Person* ViewFuzzyMenu::doViewStrategy(){ + string info_str = ViewStrategy::title_vew("=====Fuzzy Query Contact===============", "\tEnter infomation that needs to be querying: "); + int num = contact_item.size(); + int index = 0; + vector chosen_item; + + for (int i = 0; i < num; i++){ + if ((strstr(&*contact_item[i]->addr,info_str.c_str()) != NULL) || (strstr(&*contact_item[i]->name ,info_str.c_str()) != NULL) || (strstr(&*contact_item[i]->tel ,info_str.c_str()) != NULL) ) { + chosen_item.push_back(i); + cout<<"("<name<<" TEL: "<<&*contact_item[i]->tel<<" ADDR: "<<&*contact_item[i]->addr< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ViewStrategy.h" + +class ViewFuzzyMenu : public ViewStrategy +{ +public: + virtual ~ViewFuzzyMenu(){}; + Person* doViewStrategy(); +}; + +#endif // !defined(AFX_VIEWFUZZYMENU_H__D10D5C93_EEF6_40EA_AEBB_C289EE09C1EF__INCLUDED_) diff --git a/src/ViewStrategy.cpp b/src/ViewStrategy.cpp new file mode 100644 index 0000000..2443144 --- /dev/null +++ b/src/ViewStrategy.cpp @@ -0,0 +1,103 @@ +// ViewStrategy.cpp: implementation of the ViewStrategy class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ViewStrategy.h" + +string ViewStrategy::title_vew(const char* title, const char* descp) const{ + string info_str; + Person* viewPerson = NULL; + + system("cls"); + cout<>info_str; + cout<& chosen_item) const{ + int index = 0; + + if (chosen_item.size() == 0){ + cout<<"\n\t\tNo Item Found!\n"; + cin.clear(); + cin.sync(); + getch(); + return NULL; + } + else { + if (chosen_item.size() == 1){ + Sleep(400); + index = 1; + } + else{ + cout<<"\n\tEnter the INDEX(1 - "<>index; + if ((index<0) || (index>chosen_item.size())){ + return NULL; + } + }//if (chosen_item.size() == 1) + if (index > 0){ + return contact_item.at(chosen_item.at(index-1)); + } + return NULL; + }//if (chosen_item.size() == 0) +} + +void ViewStrategy::all_vew() const{ + int i = 0,j = 0; + Person* viewPerson = NULL; + + system("cls"); + cout< cur_ctg; + string tmp_ctg; + bool add_ctg; + int index = 0; + int i = 0,j = 0; + + system("cls"); + cout<category; + if (tmp_ctg == "") + tmp_ctg = "Unset"; + add_ctg = true; + for (j = 0; j>info_str; + if ((info_str == "Unset") || (info_str == "unset")) + info_str = ""; + + cout< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "CheckInterface.h" + +class ViewStrategy : public CheckInterface +{ +protected: + string title_vew(const char*, const char*) const; //for exact/fuzzy view + void all_vew() const; + string category_vew() const; + Person* anythingView(vector&) const; +public: + virtual ~ViewStrategy(){}; + virtual Person* doViewStrategy() = 0; +}; + +#endif // !defined(AFX_VIEWSTRATEGY_H__EC4D2837_CB82_4C72_90B0_0F5B88767A63__INCLUDED_) diff --git a/src/contact/Author.ctt b/src/contact/Author.ctt new file mode 100644 index 0000000..4c57559 Binary files /dev/null and b/src/contact/Author.ctt differ diff --git a/src/contact/Ms.Shrimp.ctt b/src/contact/Ms.Shrimp.ctt new file mode 100644 index 0000000..8dfff9b Binary files /dev/null and b/src/contact/Ms.Shrimp.ctt differ diff --git a/src/contacts.dsp b/src/contacts.dsp new file mode 100644 index 0000000..71854e6 --- /dev/null +++ b/src/contacts.dsp @@ -0,0 +1,237 @@ +# Microsoft Developer Studio Project File - Name="contacts" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=contacts - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "contacts.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "contacts.mak" CFG="contacts - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "contacts - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "contacts - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "contacts - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x804 /d "NDEBUG" +# ADD RSC /l 0x804 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "contacts - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x804 /d "_DEBUG" +# ADD RSC /l 0x804 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "contacts - Win32 Release" +# Name "contacts - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\CheckInterface.cpp +# End Source File +# Begin Source File + +SOURCE=.\Contact.cpp +# End Source File +# Begin Source File + +SOURCE=.\ContactInterface.cpp +# End Source File +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainDelMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainMdfMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainNewMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainStrategy.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainVewMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainVewMenuInterface.cpp +# End Source File +# Begin Source File + +SOURCE=.\Person.cpp +# End Source File +# Begin Source File + +SOURCE=.\PrtMenuInterface.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\ViewAllMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\ViewCategoryMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\ViewExactMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\ViewFuzzyMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\ViewStrategy.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\CheckInterface.h +# End Source File +# Begin Source File + +SOURCE=.\Contact.h +# End Source File +# Begin Source File + +SOURCE=.\ContactInit.h +# End Source File +# Begin Source File + +SOURCE=.\ContactInterface.h +# End Source File +# Begin Source File + +SOURCE=.\MainDelMenu.h +# End Source File +# Begin Source File + +SOURCE=.\MainMdfMenu.h +# End Source File +# Begin Source File + +SOURCE=.\MainNewMenu.h +# End Source File +# Begin Source File + +SOURCE=.\MainStrategy.h +# End Source File +# Begin Source File + +SOURCE=.\MainVewMenu.h +# End Source File +# Begin Source File + +SOURCE=.\MainVewMenuInterface.h +# End Source File +# Begin Source File + +SOURCE=.\person.h +# End Source File +# Begin Source File + +SOURCE=.\PrtMenuInterface.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\ViewAllMenu.h +# End Source File +# Begin Source File + +SOURCE=.\ViewCategoryMenu.h +# End Source File +# Begin Source File + +SOURCE=.\ViewExactMenu.h +# End Source File +# Begin Source File + +SOURCE=.\ViewFuzzyMenu.h +# End Source File +# Begin Source File + +SOURCE=.\ViewStrategy.h +# End Source File +# End Group +# End Target +# End Project diff --git a/src/contacts.dsw b/src/contacts.dsw new file mode 100644 index 0000000..80a9d29 --- /dev/null +++ b/src/contacts.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "contacts"=".\contacts.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/src/contacts.ncb b/src/contacts.ncb new file mode 100644 index 0000000..dcc8dbc Binary files /dev/null and b/src/contacts.ncb differ diff --git a/src/contacts.opt b/src/contacts.opt new file mode 100644 index 0000000..062ce96 Binary files /dev/null and b/src/contacts.opt differ diff --git a/src/contacts.plg b/src/contacts.plg new file mode 100644 index 0000000..16b71fd --- /dev/null +++ b/src/contacts.plg @@ -0,0 +1,114 @@ + + +
+

Build Log

+

+--------------------Configuration: contacts - Win32 Debug-------------------- +

+

Command Lines

+Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP5730.tmp" with contents +[ +/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"Debug/" /Fp"Debug/contacts.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\CheckInterface.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\Contact.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\ContactInterface.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\main.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\MainDelMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\MainMdfMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\MainNewMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\MainStrategy.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\MainVewMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\MainVewMenuInterface.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\Person.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\PrtMenuInterface.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\ViewAllMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\ViewCategoryMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\ViewExactMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\ViewFuzzyMenu.cpp" +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\ViewStrategy.cpp" +] +Creating command line "cl.exe @C:\Users\dell\AppData\Local\Temp\RSP5730.tmp" +Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP5731.tmp" with contents +[ +/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"Debug/" /Fp"Debug/contacts.pch" /Yc"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"C:\Users\dell\Desktop\϶ΰ 201624450324\Contacts\StdAfx.cpp" +] +Creating command line "cl.exe @C:\Users\dell\AppData\Local\Temp\RSP5731.tmp" +Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP5742.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/contacts.pdb" /debug /machine:I386 /out:"Debug/contacts.exe" /pdbtype:sept +".\Debug\CheckInterface.obj" +".\Debug\Contact.obj" +".\Debug\ContactInterface.obj" +".\Debug\main.obj" +".\Debug\MainDelMenu.obj" +".\Debug\MainMdfMenu.obj" +".\Debug\MainNewMenu.obj" +".\Debug\MainStrategy.obj" +".\Debug\MainVewMenu.obj" +".\Debug\MainVewMenuInterface.obj" +".\Debug\Person.obj" +".\Debug\PrtMenuInterface.obj" +".\Debug\StdAfx.obj" +".\Debug\ViewAllMenu.obj" +".\Debug\ViewCategoryMenu.obj" +".\Debug\ViewExactMenu.obj" +".\Debug\ViewFuzzyMenu.obj" +".\Debug\ViewStrategy.obj" +] +Creating command line "link.exe @C:\Users\dell\AppData\Local\Temp\RSP5742.tmp" +

Output Window

+Compiling... +StdAfx.cpp +Compiling... +CheckInterface.cpp +Contact.cpp +ContactInterface.cpp +main.cpp +MainDelMenu.cpp +MainMdfMenu.cpp +MainNewMenu.cpp +MainStrategy.cpp +MainVewMenu.cpp +MainVewMenuInterface.cpp +Person.cpp +PrtMenuInterface.cpp +ViewAllMenu.cpp +ViewCategoryMenu.cpp +ViewExactMenu.cpp +ViewFuzzyMenu.cpp +ViewStrategy.cpp +Generating Code... +Linking... +Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP63A7.tmp" with contents +[ +/nologo /o"Debug/contacts.bsc" +".\Debug\StdAfx.sbr" +".\Debug\CheckInterface.sbr" +".\Debug\Contact.sbr" +".\Debug\ContactInterface.sbr" +".\Debug\main.sbr" +".\Debug\MainDelMenu.sbr" +".\Debug\MainMdfMenu.sbr" +".\Debug\MainNewMenu.sbr" +".\Debug\MainStrategy.sbr" +".\Debug\MainVewMenu.sbr" +".\Debug\MainVewMenuInterface.sbr" +".\Debug\Person.sbr" +".\Debug\PrtMenuInterface.sbr" +".\Debug\ViewAllMenu.sbr" +".\Debug\ViewCategoryMenu.sbr" +".\Debug\ViewExactMenu.sbr" +".\Debug\ViewFuzzyMenu.sbr" +".\Debug\ViewStrategy.sbr"] +Creating command line "bscmake.exe @C:\Users\dell\AppData\Local\Temp\RSP63A7.tmp" +Creating browse info file... +

Output Window

+ + + +

Results

+contacts.exe - 0 error(s), 0 warning(s) +
+ + diff --git a/src/io/MainMenu.io b/src/io/MainMenu.io new file mode 100644 index 0000000..f633f08 --- /dev/null +++ b/src/io/MainMenu.io @@ -0,0 +1,15 @@ + + + ==========MAIN MENU=========== + | + ---New___1------------------- + | + ---Delete_2------------------ + | + ---Modify_3------------------ + | + ---View___4------------------ + | + ---Quit___5------------------ + + \ No newline at end of file diff --git a/src/io/View.io b/src/io/View.io new file mode 100644 index 0000000..ad332c2 --- /dev/null +++ b/src/io/View.io @@ -0,0 +1,10 @@ + + + + ====Options======= +| + -------Delete_1--- +| + -------Modify_2--- +| + -------Back___3--- diff --git a/src/io/ViewMenu.io b/src/io/ViewMenu.io new file mode 100644 index 0000000..40dc16d --- /dev/null +++ b/src/io/ViewMenu.io @@ -0,0 +1,22 @@ + + ==========VIEW CONTACT======== + | + ---********------------------ + | + ---********------------------ + | + ---********------------------ + | + ---View___*------------------ + | | + -----Exact query__1------- + | | + -----Fuzzy query__2------- + | | + -----Category_____3------- + | | + -----All__________4------- + | | + -----Back_________5------- + | + ---********------------------ diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..cade1a9 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,29 @@ +/* +========Program Entry======== +Author: ϶ΰ +Version: 1.2 +Submit Date: 18.06.20 +========================= + */ + +#include "stdafx.h" +#include "Contact.h" + +int main(int argc, char* argv[]) +{ + Contact* my_contact = new Contact(); + ContactInterface* my_interface = my_contact; + ContactInit* my_init = my_contact; + my_init->welcome(); + + while(1){ + my_init->refresh(); + if (my_interface->main_menu() == -1) + break; + } + delete my_contact; + return 0; +} + + +