資源簡介
用MFC實現的個人通訊錄,功能還算足夠。用于C++大作業。
最好用VS2010打開,其他版本沒試過。
沒積分的可以加我QQ,我直接發
代碼片段和文件信息
#include?“StdAfx.h“
#include?“AdressBookbase.h“
#include?
#include?
#include?
#include?
#include?
#include?
using?namespace?std;//基類
void?AdressBookForbase::newAccount(CString?nameCString?birthdayDayCString?birthdayMonthCString?phoneNumberCString?email)//此函數不執行任何操作
{
}
void?AdressBookForbase::Search(CString?nameCString?birthdayMonthCString?birthdayDayCString?phoneNumberCString?emailCString?others)//搜索時,當school?name,company?name,meet?site?,call?name都為空時,調用此函數搜索
{
creatAllText();//把AdressBook1~4合并到一個臨時的文件client.txt里
ifstream?hh(“client.txt“);hh.seekg(0ios::end);int?length=hh.tellg()/130;//獲取client里面一共有多少條記錄
vectorflag(length);for(int?i=0;i
if(name!=““)//如果搜索條件“名字”存在
for(int?i=0;i {string?nametemp;hh.seekg(i*130+10);hh>>nametemp;//讀取每條記錄的“名字”
if((nametemp.c_str())!=name)flag[i]=0;}//判斷名字是否符合搜索條件,不符合則標記數組對應的位置為0
if(birthdayDay!=““)???????
for(int?i=0;i {string?birthdayDaytemp;hh.seekg(i*130+25);hh>>setw(2)>>birthdayDaytemp;
if((birthdayDaytemp.c_str())!=birthdayDay)flag[i]=0;}
if(birthdayMonth!=““)
for(int?i=0;i {string?birthdayMonthtemp;hh.seekg(i*130+28);hh>>birthdayMonthtemp;
if((birthdayMonthtemp.c_str())!=birthdayMonth)flag[i]=0;}
if(phoneNumber!=““)
for(int?i=0;i {string?phoneNumbertemp;hh.seekg(i*130+31);hh>>phoneNumbertemp;
if((phoneNumbertemp.c_str())!=phoneNumber)flag[i]=0;}
if(email!=““)
for(int?i=0;i {string?emailtemp;hh.seekg(i*130+43);hh>>emailtemp;
if((emailtemp.c_str())!=email)flag[i]=0;}
ofstream?result(“temp.txt“);//這一部分用于?保存搜索結果到temp.txt里面
for(int?i=0;i if(flag[i]==1)
{ hh.seekg(i*130);string?tempRead;
for(int?k=0;k<6;k++)
{ hh>>tempRead;result< hh.close();result.close();
}
void?AdressBookForbase::creatAllText()
{
ofstream?all(“client.txt“);
ifstream?ab1(“Adressbook1.txt“);ab1.seekg(0ios::end);int?length1=ab1.tellg()/120;//獲取記錄條數
for(int?i=0;i {
string?s1s2s3s4s5;
ab1.seekg(i*120);
ab1>>s1>>s2>>s3>>s4>>s5;
all< }//上一行?保存定長記錄
ab1.close();
//以下3個文件同理
ifstream?ab2(“Adressbook2.txt“);
ab2.seekg(0ios::end);
int?length2=ab2.tellg()/120;
for(int?i=0;i {
string?s1s2s3s4s5;
ab2.seekg(i*120);
ab2>>s1>>s2>>s3>>s4>>s5;
all< }
ab2.close();
ifstream?ab3(“Adressbook3.txt“);
ab3.seekg(0ios::end);
int?length3=ab3.tellg()/120;
for(i
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-05-27?21:40??通訊錄\
?????目錄???????????0??2014-05-27?21:40??通訊錄\Debug\
?????文件?????????480??2014-05-27?21:42??通訊錄\Debug\AdressBook1.txt
?????文件?????????360??2014-05-27?21:42??通訊錄\Debug\AdressBook2.txt
?????文件?????????600??2014-05-27?21:42??通訊錄\Debug\AdressBook3.txt
?????文件?????????480??2014-05-27?21:42??通訊錄\Debug\AdressBook4.txt
?????文件?????1786368??2013-06-07?15:16??通訊錄\Debug\通訊錄.exe
?????文件?????2983640??2013-06-07?15:16??通訊錄\Debug\通訊錄.ilk
?????文件?????6441984??2013-06-07?15:16??通訊錄\Debug\通訊錄.pdb
?????目錄???????????0??2014-05-27?21:40??通訊錄\ipch\
?????目錄???????????0??2014-05-27?21:42??通訊錄\ipch\通訊錄-3e038bf3\
?????目錄???????????0??2014-05-27?21:40??通訊錄\通訊錄\
?????文件?????????322??2013-06-01?16:26??通訊錄\通訊錄\ABFfriend.h
?????文件?????????324??2013-06-01?16:26??通訊錄\通訊錄\ABFrelative.h
?????文件?????????326??2013-06-01?16:26??通訊錄\通訊錄\ABFschoolMate.h
?????文件?????????324??2013-06-01?16:22??通訊錄\通訊錄\ABFworkMate.h
?????文件????????8204??2013-06-01?15:26??通訊錄\通訊錄\ABba
?????文件????????2577??2013-06-01?15:26??通訊錄\通訊錄\ABfriend.cpp
?????文件????????2580??2013-06-01?15:26??通訊錄\通訊錄\ABrelative.cpp
?????文件????????2526??2013-06-01?15:26??通訊錄\通訊錄\ABschool.cpp
?????文件????????2542??2013-06-01?15:26??通訊錄\通訊錄\ABwork.cpp
?????文件?????????480??2013-06-10?10:19??通訊錄\通訊錄\AdressBook1.txt
?????文件?????????360??2013-06-10?10:19??通訊錄\通訊錄\AdressBook2.txt
?????文件?????????600??2013-06-10?10:19??通訊錄\通訊錄\AdressBook3.txt
?????文件?????????480??2013-06-10?10:19??通訊錄\通訊錄\AdressBook4.txt
?????文件?????????584??2013-06-01?16:26??通訊錄\通訊錄\AdressBookba
?????目錄???????????0??2014-05-27?21:40??通訊錄\通訊錄\AdressBook副本\
?????文件?????????360??2013-05-31?14:18??通訊錄\通訊錄\AdressBook副本\AdressBook1.txt
?????文件?????????360??2013-05-31?14:18??通訊錄\通訊錄\AdressBook副本\AdressBook2.txt
?????文件?????????360??2013-05-31?14:18??通訊錄\通訊錄\AdressBook副本\AdressBook3.txt
?????文件?????????360??2013-05-31?14:18??通訊錄\通訊錄\AdressBook副本\AdressBook4.txt
............此處省略90個文件信息
- 上一篇:程序設計抽象思想:C語言描述-帶書簽-源代碼
- 下一篇:MFC對話框中定義光標的熱區
評論
共有 條評論