資源簡介
C++課程設計,可以作為大作業提交,變異運行沒有任何錯誤。

代碼片段和文件信息
#include?“book_file.h“
book_file::book_file(const?string&?f_name)
{
?file_name?=?f_name;
}
book_file::~book_file(void)
{
}
bool?book_file::read_info()
{
?string?namephone;
?
?ifstream?file_in(file_name.c_str());
?
?if(!file_in.is_open())
?{
??cerr<<“打開文件出錯?“< ??file_in.close();
??return?false;
?}
?else{
??file_in>>name>>phone;
??while(!file_in.eof())
??{
???person?temp(namephone);
???file_p_list.add_person(temp);
???
???file_in>>name>>phone;
??}
?}
?file_in.close();
?return?true;
}
bool?book_file::write_info()
{
?ofstream?file_out(file_name.c_str());
?if(!file_out.is_open())
?{
??cerr<<“打開文件出錯?“< ??file_out.close();
??return?false;
?}
?else{
?
??list::const_iterator?info_iter?=?file_p_list.get_person_list().begin();
??for(;info_iter?!=?file_p_list.get_person_list().end();info_iter++)
??{
???file_out<p_name<<“\t“<p_phone<<“\n“;
??}
?}
??
?file_out.close();
?return?true;
}
phone_list&?book_file::get_data()
{
?return?file_p_list;
}
bool?book_file::set_data(const?phone_list&?ilist)
{
?file_p_list?=?ilist;
?return?true;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1218??2008-07-04?11:41??063372-趙曉東-大作業\book_file.cpp
?????文件????????513??2008-07-04?11:30??063372-趙曉東-大作業\book_file.h
?????文件???????4514??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\dazuoye.vcproj
?????文件???????1419??2008-07-04?12:05??063372-趙曉東-大作業\dazuoye\dazuoye\dazuoye.vcproj.xiaodong-PC.xiaodong.user
?????文件?????182397??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\book_file.obj
?????文件???????9984??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\BuildLog.htm
?????文件????????403??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\dazuoye.exe.em
?????文件????????468??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\dazuoye.exe.em
?????文件????????385??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\dazuoye.exe.intermediate.manifest
?????文件??????56738??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\main.obj
?????文件?????????63??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\mt.dep
?????文件??????28858??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\person.obj
?????文件?????197087??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\phone_book.obj
?????文件?????301390??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\phone_list.obj
?????文件?????273408??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\vc80.idb
?????文件?????225280??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye\Debug\vc80.pdb
?????文件?????????38??2008-07-04?12:03??063372-趙曉東-大作業\dazuoye\dazuoye\phonebook.txt
?????文件?????????38??2008-07-04?12:03??063372-趙曉東-大作業\dazuoye\dazuoye\sname.txt
?????文件????1641472??2008-07-04?12:05??063372-趙曉東-大作業\dazuoye\dazuoye.ncb
?????文件????????886??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\dazuoye.sln
????..A..H.??????7680??2008-07-04?12:05??063372-趙曉東-大作業\dazuoye\dazuoye.suo
?????文件?????118784??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\debug\dazuoye.exe
?????文件?????610012??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\debug\dazuoye.ilk
?????文件?????748544??2008-07-04?12:02??063372-趙曉東-大作業\dazuoye\debug\dazuoye.pdb
?????文件???????4673??2008-07-04?11:06??063372-趙曉東-大作業\main.cpp
?????文件????????138??2008-07-04?11:41??063372-趙曉東-大作業\person.cpp
?????文件????????271??2008-07-04?11:47??063372-趙曉東-大作業\person.h
?????文件???????2778??2008-07-04?11:57??063372-趙曉東-大作業\phone_book.cpp
?????文件????????713??2008-07-04?11:47??063372-趙曉東-大作業\phone_book.h
?????文件???????1974??2008-07-04?11:41??063372-趙曉東-大作業\phone_list.cpp
............此處省略9個文件信息
評論
共有 條評論