diff --git a/README.md b/README.md index de4e8f0..ad9d591 100644 --- a/README.md +++ b/README.md @@ -1,100 +1,59 @@ -# 基于C++的通讯录系统的设计与实现 +# 基于C++的通讯录系统 -# 一 需求分析 +# 一、实验的内容 -通讯录系统可帮助使用者管理归纳通讯录名单,达到添加,删除,修改,保存等需求。 +通讯录系统可帮助使用者管理归纳通讯录名单,达到添加,删除,修改,保存等需求。要求使用学习过的C/C++程序设计的知识完成通讯录系统的设计与实现。 -# 二 系统设计 +# 二、实验课题分析 -## 2.1 **功能模块设计** +## 2.1 通讯录系统的主要功能 -**通讯录主要功能为:**添加通讯录成员,修改成员,删除成员,按需求搜索查看成员,保存为文档。 +通讯录主要功能为:添加通讯录成员,修改成员,删除成员,按需求搜索查看成员,保存为文档。 -如下图所示: +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/873a50e1f3ff8e550170e434abd6d65d.writebug) -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/bc5ec8765192d2e34a411ca325319160.writebug) +系统各模块的功能具体描述为: -**系统各模块的功能具体描述为:** +**添加成员模块** -**1**、添加成员模块 +提供界面让使用者输入希望加入的通讯录成员的各类信息(姓名,电话,住址,QQ,邮箱等),并检查格式是否有误。若格式无误,则将该通讯录信息通过二进制文件方式储存在./contact文件目录下。 -提供界面让使用者输入希望加入的通讯录成员的各类信息(姓名,电话,住址, QQ,邮箱等),并检查格式是否有误。若格式无误,则将该通讯录信息通过二进制文件方式储存在./contact文件目录下。 +**修改成员模块** -**2**、修改成员模块 +使用者可以重写已有的通讯录成员,增加或删除除姓名以外的各个信息。一条通讯录成员可以拥有多个电话号码或QQ。 -使用者可以重写已有的通讯录成员,增加或删除除姓名以外的各个信息。一条通 讯录成员可以拥有多个电话号码或QQ。 - -**3**、删除成员模块 +**删除成员模块** 使用者可以选择某个不希望继续使用的通讯录成员并删除他们。 -**4**、搜索查看成员模块 +**搜索查看成员模块** 使用者通过各种方式查询已添加的通讯录成员,并决定是否修改或删除它们。提供的方法有:精准查询,模糊查询,按分类查询等。 -## 2.2 系统架构设计 +## 2.2 系统分析及设计 -系统开发使用Template Method设计模式和Strategy Patten 两种设计模式,较好的封装所需函数,使得主程序入口开发环节只需关注Contact.h头文件即可实现。 +系统开发使用Template Method设计模式和Strategy Patten 两种设计模式,较好的封装所需函数,使得主程序入口开发环节只需关注Contact.h头文件即可实现。具体类之间的耦合关系见下图: -具体类之间的耦合关系见下图: +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/ee90b3d45e439cf0e2a07be7ba0666a6.writebug) -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/a203ff3046cc160d1b971568683ffd63.writebug) +## 2.3 系统的实现 +### 2.3.1 类的编写 +系统工程名为:contacts。包含类:Person, Contact, ContactInterface, ContactInit等 +具体类结构声明如下: -**类的关系设计如下图所示:** +**Person类** -![](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 +```C +class Person { Public: char name[MAXNAME]; char sex; char tel[MAXTEL]; char addr[MAXADDR]; - char zip[MAXZIP]; + char zip[MAXZIP]; char mail[MAXMAIL]; char qq[MAXQQ]; char category[MAXCTGY]; @@ -102,40 +61,37 @@ Public: Person(); ~Person(); }; - ``` - **ContactInterface**类: +**ContactInterface类** -```c++ -class CheckInterface +```C +class CheckInterface { public: bool check(Person&, const bool _check_repe) const; - bool check_exact(const Person&, const string) const; + bool check_exact(const Person&, const string) const; virtual ~CheckInterface(){}; private: vector part_tq(const Person&, const char* const) const; }; - ``` - **ContactInit**类: +**ContactInit类** -```c++ -class ContactInit +```C +class ContactInit { public: - virtual int refresh() const = 0; + virtual int refresh() const = 0; virtual void welcome() const= 0; virtual ~ContactInit(){}; }; - ``` - **Contact**类: +**Contact类** -```c++ +```C class Contact : public ContactInterface, public ContactInit { private: @@ -143,15 +99,14 @@ private: public: Contact(); ~Contact(); - int refresh() const; + int refresh() const; void welcome() const; -}; - +}; ``` -**MainStrategy**类: +**MainStrategy类** -```c++ +```C class MainStrategy : public CheckInterface { public: @@ -159,18 +114,17 @@ public: virtual ~MainStrategy(); virtual int doMainStrategy() = 0; protected: - void printAll() const; + 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**类: +**MainViewMenuInterface类** -```c++ +```C class MainVewMenuInterface : public MainStrategy { public: @@ -183,82 +137,100 @@ public: virtual ~MainVewMenuInterface(); virtual int doMainStrategy(); }; - ``` -# 四 系统测试 +**类的关系设计** -## 4.1 登录界面 +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/61b902f86f8018f6d63ce4f23de85d51.writebug) -系统运行开始的界面如图所示: +各类的具体功能和说明如下: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/32dbe51ca9ec80a24acaf075328f0d88.writebug) +>class Person; 提供基本的数据存储结构。 +>class ContactInterface; 提供主函数菜单,策略选择方法。是Contact类的一个接口,MainStrategy的调用者。 +>class ContactInit; 提供初始化程序所需函数。同样是Contact类的一个接口。 +>class Contact; 具体实现了两个接口的方法。MainStrategy的决策者。同时面向调用者(main.cpp)。但注意Contact不提供任何public方法。需要通过两个接口调用。 +>class CheckInterface; 提供检查函数。 +>class MainStrategy; Strategy Patten设计模式。同时包含子类公用的方法。 +>class MainNewMenu; class MainDelMenu; class MainMdfMenu; 分别override doMainStrategy()函数,实现新建,删除,修改功能。 +>class MainVewMenuInterface; override doMainStrategy()函数,ViewStrategy的调用者。 +>class MainVewMenu; ViewStrategy的决策者。 +>class ViewStrategy; Strategy Patten。 +>class ViewAllMenu; class ViewExactMenu; +>class ViewFuzzyMenu; class ViewCategoryMenu; 分别override doViewStrategy()函数,实现所有查找,精确查找,模糊查找,按类查找功能。 + +**通讯录实现流程图** + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/54d05a5c2d598c0d46c71672bebeac9c.writebug) + +### 2.3.2 交互界面以及登录菜单的实现 + +**系统运行开始的界面如图所示** + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/9f96d4bea111dda62495eaa8decb32e5.writebug) 主要通过选择结构和循环结构实现界面的前进和后退。例如,第一个登录界面出现5个选择:1.新建,2.删除,3.修改,4.浏览,5.退出 -## 4.2 添加联系人 +# 三、实验调试、测试、运行记录及分析 + +系统在调试测试过程中遇到若干问题,不过经过仔细反复的检查已经消除各种漏洞。 + +主要的测试经过如下: + +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/6f53cb0dcbdf55fd703f64b50ae0d4ad.writebug) 在开始界面输入“1”即添加新的成员: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/3daf468c06b3014d605f10ec00365ebe.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/e4f50dc22f11d26e457578f085303a97.writebug) - 若显示 Information Entry Success! 则录入数据成功。若显示Information Error! 则录入数据失败。如图则因为在电话(TEL)中出现了中文字符。随后将返回主界面。 +若显示 Information Entry Success! 则录入数据成功。若显示Information Error! 则录入数据失败。如图则因为在电话(TEL)中出现了中文字符。随后将返回主界面。 -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/fe23be738be6c25fadf86502f96ea086.writebug) - -## 4.3 删除联系人 +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/1b0716f1e6442130639bcf7a30b3aa7b.writebug) 在主界面输入2可删除成员: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/e6c9d2abdbec776664748b61fbff9f9f.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/3f1abeb90240457332dbf08175bcc6f1.writebug) 如我们希望删除(2)数据,则键入2: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/a9e40e12e21a997342a33c55b0fe34d0.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/7a60eec0d254cd7973199011b7910bf9.writebug) 就可以得到(2)的详细数据。输入y/n即可选择是否删除该成员。随后程序将返回主界面。 -## 4.4 修改联系人 - 在主界面下输入3可以修改已有的成员:我们希望修改刚刚加入的成员(1)的电话号码,同时加入他所有常用的QQ号码: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/22cda86e3b5dd5bce444b94980e3bc54.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/bf0e411a2580cbe6aa625dcde26bcbe8.writebug) -键入1, 可修改第一个人的信息,并按照需求修改信息: +键入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/00e606fa87b5e462913c538b9ce023f9.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) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/56e53730ac01df68a0ec48c85e1fa4b1.writebug) 键入1进行精准匹配,该模式下只匹配名字:如输入“严恩伟”后匹配信息如图: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/c6d8d639c5f8e2d9fdc402b98bcabd29.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/38cfbb157c7990d9b1acbafeb9219a89.writebug) 随后可以根据自身需求选择1-3选项。此处不再演示。 在view模式下键入2进行模糊匹配,该模式匹配名字,电话,地址。只要出现匹配字符即给与显示。如输入“181”后显示: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/f97505b0dc12dcd8e79ea14b481cbc0f.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/d9d9afac07e79866fdd0702b3c333394.writebug) 选择1-3即可进入其详细页面。此处不再演示。 在view模式下键入3进行分类(category)匹配。该模式会列出所有的分类,并可根据用户选择的分类进行罗列(其中未设置的分类被标记为Unset): -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/ecf4c1f266c330014fc34ffbdf9086bf.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/fdd143f5d10c987122a2a8c5b4d0f91c.writebug) 根据提示选择1-2即可进入相应页面。选择0即可退出。 在view模式下键入4进行全局匹配。该模式会列出所有的成员: -![](http://www.write-bug.com/myres/static/uploads/2021/10/19/b49f90fdd2d7887d5d1e1251d2001d06.writebug) +![](http://www.write-bug.com/myres/static/uploads/2021/10/19/b6faf525d0fc0376c25d87bae4c494e4.writebug) 在view模式下键入5退出view模式。 diff --git a/src2/C++程序设计课程设计.doc b/src2/C++程序设计课程设计.doc new file mode 100644 index 0000000..18aac65 Binary files /dev/null and b/src2/C++程序设计课程设计.doc differ diff --git a/src2/CheckInterface.cpp b/src2/CheckInterface.cpp new file mode 100644 index 0000000..2765d0f --- /dev/null +++ b/src2/CheckInterface.cpp @@ -0,0 +1,144 @@ +// CheckInterface.cpp: implementation of the CheckInterface class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "CheckInterface.h" + + +bool CheckInterface::check(Person& person, const bool _check_repe) const { + unsigned 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){ + 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 (unsigned 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 (unsigned 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/src2/Contact.cpp b/src2/Contact.cpp new file mode 100644 index 0000000..4320c38 --- /dev/null +++ b/src2/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/src2/Contact.h b/src2/Contact.h new file mode 100644 index 0000000..5eb0827 --- /dev/null +++ b/src2/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(MainStrategy*); //... + 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/src2/ContactInit.h b/src2/ContactInit.h new file mode 100644 index 0000000..b14a1fe --- /dev/null +++ b/src2/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/src2/ContactInterface.cpp b/src2/ContactInterface.cpp new file mode 100644 index 0000000..2255a3c --- /dev/null +++ b/src2/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/src2/ContactInterface.h b/src2/ContactInterface.h new file mode 100644 index 0000000..6125be1 --- /dev/null +++ b/src2/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(MainStrategy*) = 0; +protected: + int MainFunctionsNum; +public: + int main_menu(); + virtual ~ContactInterface(){}; +}; + +#endif // !defined(AFX_CONTACTINTERFACE_H__61397655_84DB_48A0_A5E4_041E75321807__INCLUDED_) diff --git a/src2/MainDelMenu.cpp b/src2/MainDelMenu.cpp new file mode 100644 index 0000000..8d4e182 --- /dev/null +++ b/src2/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/src2/MainDelMenu.h b/src2/MainDelMenu.h new file mode 100644 index 0000000..f24c976 --- /dev/null +++ b/src2/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/src2/MainMdfMenu.cpp b/src2/MainMdfMenu.cpp new file mode 100644 index 0000000..e97d34c --- /dev/null +++ b/src2/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/src2/MainMdfMenu.h b/src2/MainMdfMenu.h new file mode 100644 index 0000000..eb1decb --- /dev/null +++ b/src2/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/src2/MainNewMenu.cpp b/src2/MainNewMenu.cpp new file mode 100644 index 0000000..539214b --- /dev/null +++ b/src2/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/src2/MainStrategy.cpp b/src2/MainStrategy.cpp new file mode 100644 index 0000000..4acdeab --- /dev/null +++ b/src2/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/src2/MainStrategy.h b/src2/MainStrategy.h new file mode 100644 index 0000000..d8baa9b --- /dev/null +++ b/src2/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/src2/MainTestMenu.cpp b/src2/MainTestMenu.cpp new file mode 100644 index 0000000..f49003b --- /dev/null +++ b/src2/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/src2/MainTestMenu.h b/src2/MainTestMenu.h new file mode 100644 index 0000000..b6d67dc --- /dev/null +++ b/src2/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/src2/MainVewMenu.cpp b/src2/MainVewMenu.cpp new file mode 100644 index 0000000..a71cd5d --- /dev/null +++ b/src2/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(ViewStrategy* p){ + delete p; +} + diff --git a/src2/MainVewMenu.h b/src2/MainVewMenu.h new file mode 100644 index 0000000..9798e9a --- /dev/null +++ b/src2/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(ViewStrategy*); +public: + MainVewMenu(); + virtual ~MainVewMenu(){}; +}; + +#endif // !defined(AFX_MAINVEWMENU_H__30EDC353_618B_4196_A8BB_4A59557068CD__INCLUDED_) diff --git a/src2/MainVewMenuInterface.cpp b/src2/MainVewMenuInterface.cpp new file mode 100644 index 0000000..2629d8a --- /dev/null +++ b/src2/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/src2/MainVewMenuInterface.h b/src2/MainVewMenuInterface.h new file mode 100644 index 0000000..8a57857 --- /dev/null +++ b/src2/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(ViewStrategy*) = 0; +protected: + int ViewFunctionsNum; +public: + virtual ~MainVewMenuInterface(){}; + int doMainStrategy(); +}; + +#endif // !defined(AFX_MAINVEWMENUINTERFACE_H__7A32F346_890E_45E1_941B_4FC6A6A3714A__INCLUDED_) diff --git a/src2/Person.cpp b/src2/Person.cpp new file mode 100644 index 0000000..58e5c37 --- /dev/null +++ b/src2/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/src2/Person.h b/src2/Person.h new file mode 100644 index 0000000..4fb22a4 --- /dev/null +++ b/src2/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/src2/PrtMenuInterface.cpp b/src2/PrtMenuInterface.cpp new file mode 100644 index 0000000..46f95b6 --- /dev/null +++ b/src2/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/src2/README.md b/src2/README.md new file mode 100644 index 0000000..60aff32 --- /dev/null +++ b/src2/README.md @@ -0,0 +1,2 @@ +# contacts +c++ 课程设计 diff --git a/src2/ViewAllMenu.cpp b/src2/ViewAllMenu.cpp new file mode 100644 index 0000000..f12fdcd --- /dev/null +++ b/src2/ViewAllMenu.cpp @@ -0,0 +1,20 @@ +// ViewAllMenu.cpp: implementation of the ViewAllMenu class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ViewAllMenu.h" + +Person* ViewAllMenu::doViewStrategy(){ + int num = contact_item.size(); + 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/src2/ViewCategoryMenu.cpp b/src2/ViewCategoryMenu.cpp new file mode 100644 index 0000000..7426920 --- /dev/null +++ b/src2/ViewCategoryMenu.cpp @@ -0,0 +1,21 @@ +// 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(); + 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/src2/ViewExactMenu.cpp b/src2/ViewExactMenu.cpp new file mode 100644 index 0000000..6532b31 --- /dev/null +++ b/src2/ViewExactMenu.cpp @@ -0,0 +1,21 @@ +// 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(); + 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/src2/ViewFuzzyMenu.cpp b/src2/ViewFuzzyMenu.cpp new file mode 100644 index 0000000..6c22139 --- /dev/null +++ b/src2/ViewFuzzyMenu.cpp @@ -0,0 +1,21 @@ +// 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(); + 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/src2/ViewStrategy.cpp b/src2/ViewStrategy.cpp new file mode 100644 index 0000000..03521bb --- /dev/null +++ b/src2/ViewStrategy.cpp @@ -0,0 +1,98 @@ +// 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; + + system("cls"); + cout<>info_str; + cout<& chosen_item) const{ + unsigned 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>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{ + system("cls"); + cout< cur_ctg; + string tmp_ctg; + bool add_ctg; + unsigned 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/src2/contact/Author.ctt b/src2/contact/Author.ctt new file mode 100644 index 0000000..4c57559 Binary files /dev/null and b/src2/contact/Author.ctt differ diff --git a/src2/contact/Ms.Shrimp.ctt b/src2/contact/Ms.Shrimp.ctt new file mode 100644 index 0000000..8dfff9b Binary files /dev/null and b/src2/contact/Ms.Shrimp.ctt differ diff --git a/src2/contacts.dsp b/src2/contacts.dsp new file mode 100644 index 0000000..71854e6 --- /dev/null +++ b/src2/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/src2/contacts.dsw b/src2/contacts.dsw new file mode 100644 index 0000000..80a9d29 --- /dev/null +++ b/src2/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/src2/contacts.ncb b/src2/contacts.ncb new file mode 100644 index 0000000..b75a271 Binary files /dev/null and b/src2/contacts.ncb differ diff --git a/src2/contacts.opt b/src2/contacts.opt new file mode 100644 index 0000000..a93615a Binary files /dev/null and b/src2/contacts.opt differ diff --git a/src2/contacts.plg b/src2/contacts.plg new file mode 100644 index 0000000..cf104a3 --- /dev/null +++ b/src2/contacts.plg @@ -0,0 +1,147 @@ + + +
+

Build Log

+

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

+

Command Lines

+Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP7BD3.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 +"G:\Contact\CheckInterface.cpp" +"G:\Contact\Contact.cpp" +"G:\Contact\ContactInterface.cpp" +"G:\Contact\main.cpp" +"G:\Contact\MainDelMenu.cpp" +"G:\Contact\MainMdfMenu.cpp" +"G:\Contact\MainNewMenu.cpp" +"G:\Contact\MainStrategy.cpp" +"G:\Contact\MainVewMenu.cpp" +"G:\Contact\MainVewMenuInterface.cpp" +"G:\Contact\Person.cpp" +"G:\Contact\PrtMenuInterface.cpp" +"G:\Contact\ViewAllMenu.cpp" +"G:\Contact\ViewCategoryMenu.cpp" +"G:\Contact\ViewExactMenu.cpp" +"G:\Contact\ViewFuzzyMenu.cpp" +"G:\Contact\ViewStrategy.cpp" +] +Creating command line "cl.exe @C:\Users\dell\AppData\Local\Temp\RSP7BD3.tmp" +Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP7BD4.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 +"G:\Contact\StdAfx.cpp" +] +Creating command line "cl.exe @C:\Users\dell\AppData\Local\Temp\RSP7BD4.tmp" +Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP7BD5.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\RSP7BD5.tmp" +

Output Window

+Compiling... +StdAfx.cpp +Compiling... +CheckInterface.cpp +d:\program files (x86)\microsoft visual studio\vc98\include\vector(48) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@IABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information + G:\Contact\CheckInterface.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(61) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@0ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information + G:\Contact\CheckInterface.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(103) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\CheckInterface.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(105) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\CheckInterface.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(107) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\CheckInterface.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(108) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\CheckInterface.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +G:\Contact\CheckInterface.cpp(110) : warning C4786: 'std::reverse_iterator,std::allocator > const *,std::basic_string,std::allocator >,std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const *,int>' : identifier was truncated to '255' characters in the debug information +G:\Contact\CheckInterface.cpp(110) : warning C4786: 'std::reverse_iterator,std::allocator > *,std::basic_string,std::allocator >,std::basic_string,std::allocator > &,std::basic_string,std::allocator > *,int>' : identifier was truncated to '255' characters in the debug information +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 +d:\program files (x86)\microsoft visual studio\vc98\include\vector(48) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@IABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information + G:\Contact\ViewStrategy.cpp(65) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(61) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@0ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information + G:\Contact\ViewStrategy.cpp(65) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(103) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\ViewStrategy.cpp(65) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(105) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\ViewStrategy.cpp(65) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(107) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\ViewStrategy.cpp(65) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +d:\program files (x86)\microsoft visual studio\vc98\include\vector(108) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information + G:\Contact\ViewStrategy.cpp(65) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled +G:\Contact\ViewStrategy.cpp(98) : warning C4786: 'std::reverse_iterator,std::allocator > const *,std::basic_string,std::allocator >,std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const *,int>' : identifier was truncated to '255' characters in the debug information +G:\Contact\ViewStrategy.cpp(98) : warning C4786: 'std::reverse_iterator,std::allocator > *,std::basic_string,std::allocator >,std::basic_string,std::allocator > &,std::basic_string,std::allocator > *,int>' : identifier was truncated to '255' characters in the debug information +Generating Code... +d:\program files (x86)\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > > >::vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information +d:\program files (x86)\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > > >::~vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information +d:\program files (x86)\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > > >::vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information +d:\program files (x86)\microsoft visual studio\vc98\include\vector(52) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > > >::vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information +d:\program files (x86)\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > > >::~vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information +Linking... +Creating temporary file "C:\Users\dell\AppData\Local\Temp\RSP8ACA.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\RSP8ACA.tmp" +Creating browse info file... +

Output Window

+ + + +

Results

+contacts.exe - 0 error(s), 21 warning(s) +
+ + diff --git a/src2/io/MainMenu.io b/src2/io/MainMenu.io new file mode 100644 index 0000000..f633f08 --- /dev/null +++ b/src2/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/src2/io/View.io b/src2/io/View.io new file mode 100644 index 0000000..ad332c2 --- /dev/null +++ b/src2/io/View.io @@ -0,0 +1,10 @@ + + + + ====Options======= +| + -------Delete_1--- +| + -------Modify_2--- +| + -------Back___3--- diff --git a/src2/io/ViewMenu.io b/src2/io/ViewMenu.io new file mode 100644 index 0000000..40dc16d --- /dev/null +++ b/src2/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/src2/main.cpp b/src2/main.cpp new file mode 100644 index 0000000..cade1a9 --- /dev/null +++ b/src2/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; +} + + + diff --git a/src2/makefile b/src2/makefile new file mode 100644 index 0000000..948f357 --- /dev/null +++ b/src2/makefile @@ -0,0 +1,69 @@ +#MakeFile created by automake-OvenVan + +BIN = contact.exe +CC = gcc +CFLAG = -g3 -Wall -static-libgcc =std=c++11 +CXX = g++ +CXXFLAG = -g3 -Wall -static-libgcc -std=c++11 -lstdc++ +OBJ = CheckInterface.o Contact.o ContactInterface.o MainDelMenu.o MainMdfMenu.o MainNewMenu.o MainStrategy.o MainTestMenu.o MainVewMenu.o MainVewMenuInterface.o Person.o PrtMenuInterface.o StdAfx.o ViewAllMenu.o ViewCategoryMenu.o ViewExactMenu.o ViewFuzzyMenu.o ViewStrategy.o main.o + +$(BIN): $(OBJ) + $(CXX) $(OBJ) -o $(BIN) + +CheckInterface.o: CheckInterface.cpp + $(CC) -c CheckInterface.cpp -o CheckInterface.o $(CXXFLAG) + +Contact.o: Contact.cpp + $(CC) -c Contact.cpp -o Contact.o $(CXXFLAG) + +ContactInterface.o: ContactInterface.cpp + $(CC) -c ContactInterface.cpp -o ContactInterface.o $(CXXFLAG) + +MainDelMenu.o: MainDelMenu.cpp + $(CC) -c MainDelMenu.cpp -o MainDelMenu.o $(CXXFLAG) + +MainMdfMenu.o: MainMdfMenu.cpp + $(CC) -c MainMdfMenu.cpp -o MainMdfMenu.o $(CXXFLAG) + +MainNewMenu.o: MainNewMenu.cpp + $(CC) -c MainNewMenu.cpp -o MainNewMenu.o $(CXXFLAG) + +MainStrategy.o: MainStrategy.cpp + $(CC) -c MainStrategy.cpp -o MainStrategy.o $(CXXFLAG) + +MainTestMenu.o: MainTestMenu.cpp + $(CC) -c MainTestMenu.cpp -o MainTestMenu.o $(CXXFLAG) + +MainVewMenu.o: MainVewMenu.cpp + $(CC) -c MainVewMenu.cpp -o MainVewMenu.o $(CXXFLAG) + +MainVewMenuInterface.o: MainVewMenuInterface.cpp + $(CC) -c MainVewMenuInterface.cpp -o MainVewMenuInterface.o $(CXXFLAG) + +Person.o: Person.cpp + $(CC) -c Person.cpp -o Person.o $(CXXFLAG) + +PrtMenuInterface.o: PrtMenuInterface.cpp + $(CC) -c PrtMenuInterface.cpp -o PrtMenuInterface.o $(CXXFLAG) + +StdAfx.o: StdAfx.cpp + $(CC) -c StdAfx.cpp -o StdAfx.o $(CXXFLAG) + +ViewAllMenu.o: ViewAllMenu.cpp + $(CC) -c ViewAllMenu.cpp -o ViewAllMenu.o $(CXXFLAG) + +ViewCategoryMenu.o: ViewCategoryMenu.cpp + $(CC) -c ViewCategoryMenu.cpp -o ViewCategoryMenu.o $(CXXFLAG) + +ViewExactMenu.o: ViewExactMenu.cpp + $(CC) -c ViewExactMenu.cpp -o ViewExactMenu.o $(CXXFLAG) + +ViewFuzzyMenu.o: ViewFuzzyMenu.cpp + $(CC) -c ViewFuzzyMenu.cpp -o ViewFuzzyMenu.o $(CXXFLAG) + +ViewStrategy.o: ViewStrategy.cpp + $(CC) -c ViewStrategy.cpp -o ViewStrategy.o $(CXXFLAG) + +main.o: main.cpp + $(CC) -c main.cpp -o main.o $(CXXFLAG) + diff --git a/src2/stdafx.cpp b/src2/stdafx.cpp new file mode 100644 index 0000000..8846fd9 --- /dev/null +++ b/src2/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; diff --git a/src2/stdafx.h b/src2/stdafx.h new file mode 100644 index 0000000..e58a078 --- /dev/null +++ b/src2/stdafx.h @@ -0,0 +1,18 @@ +// 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_ + +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +#endif // !defined(AFX_STDAFX_H__F5925CEB_85C9_4293_8D63_288D374D3EDC__INCLUDED_)