VisualC++6.0實驗報告電話簿管理程序設計_第1頁
VisualC++6.0實驗報告電話簿管理程序設計_第2頁
VisualC++6.0實驗報告電話簿管理程序設計_第3頁
VisualC++6.0實驗報告電話簿管理程序設計_第4頁
VisualC++6.0實驗報告電話簿管理程序設計_第5頁
已閱讀5頁,還剩11頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、實 驗 報 告課程名稱 面向?qū)ο蟪绦蛟O計 實驗名稱 電話簿管理程序設計 實驗類型 設計型 實驗地點 xxx 實驗日期 xxx 指導教師 xxx 專 業(yè) xxx 班 級 xxx 學 號 xxx 姓 名 xxx 成 績 實驗報告說明 1、 封面內(nèi)容(1)課程名稱:實驗所屬的課程的名稱。(2)實驗名稱:要用最簡練的語言反映實驗的內(nèi)容。要求與實驗指導書中相一致。(3)實驗類型:說明是驗證型實驗、設計型實驗、創(chuàng)新型實驗還是綜合型實驗。2、正文內(nèi)容實驗報告的正文內(nèi)容須包括以下內(nèi)容:(1)實驗目的:目的要明確,要抓住重點,符合實驗指導書中的要求。(2)實驗內(nèi)容:說明本實驗的主要內(nèi)容。(3)實驗原理:簡要說明

2、本實驗項目所涉及的理論知識。(4)實驗環(huán)境:實驗用的軟硬件環(huán)境(配置)。(5)實驗方案:對于驗證性型實驗,寫明依據(jù)何種原理、操作方法進行實驗;對于設計型和綜合型實驗,寫明依據(jù)何種原理、操作方法進行實驗,并畫出硬件組成圖、軟件流程圖、設計思路和設計方法,再配以相應的文字說明;對于創(chuàng)新型實驗,除符合設計型和綜合型實驗要求外,還應注明其創(chuàng)新點、特色。(6)實驗步驟:寫明實驗的實施步驟,包括實驗過程中的記錄、數(shù)據(jù)。(7)實驗結(jié)果與分析:寫明實驗的最終結(jié)果,并對結(jié)果進行分析,做出結(jié)論。(8)實驗中遇到的問題及解決方法:寫明實驗過程中遇到的問題及所采取的解決方法。(9)實驗總結(jié)(在封底上):寫出對本次實驗

3、的心得體會、思考和建議。綜合實驗 電話簿管理程序設計(1)實驗目的: 綜合運用面向?qū)ο蟪绦蛟O計的基礎知識,設計一個小型的應用程序,提高解決問題的能力。(2)實驗內(nèi)容:設計一個電話簿管理程序,要求:1具有添加、刪除、顯示、修改和查詢聯(lián)系人電話號碼的功能。2聯(lián)系人的信息保存到文件中。3可以實現(xiàn)為控制臺程序或圖形界面程序。4按學院實驗報告要求格式書寫實驗報告。(3)實驗環(huán)境:microsoft visual c+ 6.0 開發(fā)環(huán)境(4)實驗程序:#include #include #include #include #include using namespace std;class bookpub

4、lic: book();/默認構(gòu)造函數(shù) char inter_face();/首頁 void add_person();/添加 void del_person();/刪除 void show_all();/顯示 void alter();/修改 void select();/查詢 void save_new();/保存private: string name;/姓名string number;/電話號碼;book:book()name = 0;number = 0;/首頁char book:inter_face()system(cls); cout endl; cout請選擇你要進行的操作:

5、endl 1.添加. 2.刪除. 3.顯示. 4.修改. 5.查詢. 6.關(guān)閉.endl choose; fflush(stdin); return choose;/添加聯(lián)系人void book:add_person()cout endl 根據(jù)下面提示輸入新聯(lián)系人信息 endl name; fflush(stdin); cout number; fflush(stdin); save_new(); cout endl endl 已保存 endl; system(pause);/刪除聯(lián)系人void book:del_person()ofstream outdata(temp.txt, ios:o

6、ut); ifstream indata(pbook.txt, ios:in); if (!outdata | !indata)cout endl 對不起找不到文件 endl; system(pause); return; string sign; cout endl sign; string str1; bool flag = true; string str; while (indata name number) getline(indata, str); if (sign=name) | (sign=number) cout endl 你想刪除的聯(lián)系人: endl; cout str1

7、endl; cout setiosflags(ios:left) setw(17) name number str endl; flag = false; break; outdata setiosflags(ios:left) setw(17) name number str endl; if (flag) cout endl 對不起,聯(lián)系人中沒你找的人 endl; else while (getline(indata, str) outdata str endl; outdata.close(); indata.close(); ofstream out(pbook.txt, ios:ou

8、t); ifstream in(temp.txt, ios:in); if (!out | !in) cout endl 對不起不能打開文件 endl; system(pause); return; while (getline(in, str) out str endl; out.close();/ in.close(); cout endl 已刪除 endl; system(pause); /顯示所有聯(lián)系人void book:show_all() ifstream indata(pbook.txt,ios:in); if (!indata) cout endl 對不起,沒有找到文件 end

9、l; system(pause); return; bool flag = true; string record; while (getline(indata, record) if (flag) cout endl 所有聯(lián)系人信息如下: endl; cout record endl; flag = false; if (flag) cout endl 你的通迅錄中沒有聯(lián)系人 endl; else cout endl 所有聯(lián)系人已經(jīng)全部顯示出來 endl; system(pause);/修改信息void book:alter() ofstream outdata(temp.txt, ios:

10、out); ifstream indata(pbook.txt, ios:in); /if (!outdata | !indata) cout endl 對不起,找不到文件 endl; system(pause); return; string sign; cout endl sign; string str1; bool flag = true; string str; while (indata name number) getline(indata, str); if (sign=name) | (sign=number) cout endl 你想修改的聯(lián)系人: endl endl; c

11、out str1 endl; cout setiosflags(ios:left) setw(17) name number str endl; cout endl 請根據(jù)下面提示修改信息 : endl; cout name; fflush(stdin); cout number; fflush(stdin);save_new(); flag = false; break; outdata setiosflags(ios:left) setw(17) name number str endl; if (flag) cout endl 對不起,聯(lián)系人中沒你找的人 endl; else while

12、 (getline(indata, str) outdata str endl; outdata.close(); indata.close(); ofstream out(pbook.txt, ios:out); ifstream in(temp.txt, ios:in); if (!out | !in) cout endl 對不起不能打開文件 endl; system(pause); return; while (getline(in, str) out str endl; out.close(); in.close(); cout endl 這個人的信息已經(jīng)在你的通迅錄中修改 endl;

13、 system(pause); /查詢聯(lián)系人void book:select() ifstream indata(pbook.txt,ios:in); if (!indata) cout endl 對不起,文件找不到 endl; system(pause); return; string sign; cout endl sign; fflush(stdin); string str1; bool flag = true; string str; while (indata name number) getline(indata, str); if (name=sign) | (number=s

14、ign) cout endl 你要查找的聯(lián)系人是: endl; cout str1 endl; cout setiosflags(ios:left) setw(17) name number str endl; flag = false; system(pause); break; void book:save_new() ofstream outdata(pbook.txt, ios:app); if (!outdata) cout endl 對不起,打開文件失敗 endl; system(pause); return; outdata setiosflags(ios:left) setw(

15、17) name setw(16) number endl; outdata.close();int main() int choose; book abj; while (choose = er_face() switch (choose) case 1: abj.add_person();/添加聯(lián)系人 break; case 2: abj.del_person();/刪除聯(lián)系人 break;case 3: abj.show_all();/顯示所有聯(lián)系人 break;case 4: abj.alter();/修改信息 break;case 5: abj.select();/查詢

16、聯(lián)系人 break;case 6: cout endl 謝謝使用 endl; exit(0); break; default: break; return 0;(5)實驗結(jié)果:輸入:1分別輸入虛渺,雨拓,若風三人姓名和電話號碼輸入:2刪除虛渺相關(guān)信息輸入:3顯示已存儲的聯(lián)系人輸入:4修改雨拓電話號碼輸入:5查詢雨拓電話號碼輸入:6(6)實驗中遇到的問題及解決方法:在本次實驗中主要在對類的建立和訪問的編寫的過程中遇到了困難,經(jīng)過上機調(diào)試和同學的幫助,順利的改正了這類問題。得到了解決,同時也對此類問題有了更好的理解。相信在今后的學習中會用很多的幫助?!緦嶒灴偨Y(jié)】通過本次實驗我能夠基本掌握面向?qū)ο蟪绦蛟O計的基礎知識,在對電話簿管理程序的編寫過程中了解了面向?qū)ο蟪绦蛟O計的應用,也在上機實踐和對程序調(diào)試的同時提高了自己解決問題的能力。在這段時間的上機實踐中,我學會了很多,了解了如何應用microsoft visual c+環(huán)境實現(xiàn)工程的創(chuàng)建,類的生成等,可以說這次上機讓我對課堂所學的知識有

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論