




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
通訊錄管理問題描述編寫一個簡單的通訊錄管理程序。通訊錄記錄有姓名,地址(省、市(縣)、街道),電話號碼,郵政編碼等四項。基本要求程序應提供的基本管理功能有:添加:即增加一個人的記錄到通信錄中顯示:即在屏幕上顯示所有通信錄中的人員信息,應能分屏顯示。存儲:即將通訊錄信息保存在一個文件中。裝入:即將文件中的信息讀入程序。查詢:可根據姓名查找某人的相關信息,若找到顯示其姓名、地址、電話號碼和郵政編碼。修改:可修改一個人的除姓名外其它信息。測試數據程序應輸入不少于10個人員的通訊錄信息,應考慮到人員可以同名的情況。實現提示程序可用一個動態數組來管理人員信息,每個人員的姓名,地址,電話號碼和郵政編碼用一個類Cperson來實現,作為動態數組的值指針指向這些Cperson類對象,通過動態數組的遍歷可以操作這些數據。目錄【摘要】 第1章概述1.1系統實現的目標1.2系統實現方案 1.3系統實現環境 1.4具體的開發方法第2章系統設計 2.1總體設計 2.2類設計 2.3數據結構 2.4界面設計 第3章系統實現 【摘要】日益繁多的人際交往使得我們很難記住與每個人之間的聯系方式,通訊錄能夠便捷的給我們帶來所需要的相關信息。而隨著計算機的普及,人們的生活擺脫了傳統式的記事本、電話簿,越來越多的靠計算機或者手機中的電話簿程序來幫助人們記住這些事情,極其簡便。這就需要有一個使用的通訊錄管理系統,用戶可以方便的通過自己電腦的通訊錄管理系統,來隨時查閱自己所需要的信息,而不必再大費周折去翻開那繁瑣的記事本。通訊錄管理系統是一個專門針對儲存用戶聯系方式以及一些簡單個人信息的實用管理系統,它方便了用戶對眾多客戶、朋友、同事等個人信息的儲存和快速查閱的功能,大大減少了查找過程的時間。1.1系統實現的目標(1)錄入:通訊錄信息包括:姓名,電話,地址,E-mail,郵編等信息。(2)更新:能插入、刪除通訊錄信息。.(3)瀏覽:能夠查看所有的通訊錄信息。(4)查詢:能實現指定姓名信息查詢或指定編號查詢功能。(5)系統以菜單方式工作,界面友好,易于操作。1.2系統實現方案為實現系統功能,本程序主要分為五個模塊。它們分別為:輸入一個信息、刪除一個信息、查詢一個信息、插入一個信息、列出所有的信息、退出該程序。這五個函數再通過主函數調用分別得以實現。主函數,首先提供了程序運行時的友好界面,列出了清單,提供用戶做出選擇,以便決定使用通訊錄的哪種功能。然后,通過執行多分支選擇語句——switch語句,分別實現其它各個函數的調用功能。1.3系統實現環境通過VC++6.0用C++語言對程序進行編寫設計在windows界面下用DOS訪問1.4具體的開發方法用面向對象的程序設計方法,運用C++語言編寫程序進行該學生考勤管理系統的詳細設計,使之能提供錄入、顯示、查找、刪除、修改的功能。最后在VC++6.0環境下編寫和調試程序,進而完成系統的實現。第2章系統設計2.1總體設計功能:1.輸入聯系人的信息2.顯示聯系人的信息3.查找聯系人的信息4.刪除聯系人的信息5.編輯人的信息一程序分析階段該程序有六項功能,即添加、顯示、存儲、裝入、查詢、修改,要完成此六項功能必須有六項實現該功能的函數,和類的構造相聯系知此六項功能即為類的行為,此為行為抽象。該程序又有四項屬性,即姓名、地址、電話號碼、郵政編碼,又因為地址有三項成員,即省、市、街道,由此可知可將數據成員分為兩個類,即Cperson類和Address類,此為類的數據成員。此為數據抽象。至此類的數據成員和行為成員形成。二程序設計階段由于人員信息較多,可考慮使用對象數組來管理人員信息,作為動態數組的值指針指向這些Cperson類對象,通過動態數組的遍歷可以操作這些數據。程序應輸入不少于10個人員的通訊錄信息,應考慮到人員可以同名的情況。當人員同名是應該考慮其他的屬性。三程序編程階段1:編程之前應該先畫出該類的UML圖。Cperson—phonenumber:int—Cperson—phonenumber:int—lastdate:int—name:string—address:Address—postnumber:string—balance:double—time:double—<<const>>price:double—<<static>>n:int+Cperson():void+getbalance():void+gettime():void+record(date:int,account:double):double+show():void+select(name:string):void+alter(phonenumber:int):void+insert(phonenumber:int):voidAddress—province:string—city:string—street:string+Address()+getAddress()+Address(Address&add)第三章系統實現//Address類的設計#ifndefAddress_h#defineAddress_h#include<string>classAddress{private: std::stringprovince; std::stringcity; std::stringstreet;public: Address(){} Address(std::stringprovince,std::stringcity,std::stringstreet); voidgetaddress(std::stringprovince,std::stringcity,std::stringstreet); Address(Address&address1); ~Address();};#endif//Cperson類的設計#ifndefCperson_h#defineCperson_h#include<string>classCperson//通信用戶類{public:Cperson(); Cperson(intphonenumber,intdate,char*name1,Address&address,std::stringpostnumber); doublegetbalance()const{returnbalance;} doublegettime()const{returntime;} voidinputmoney(intdate,doubleaccount); voidrecord(intdate,doubleaccount); voidsettle(intdate,doubletime); staticunsignedintgettotal(){returnn;} voidinput(intphonenumber,char*name1,Address&address,std::stringpostnumber,doublebalance,doubletime); voidshow()const;voidselect(char*name); voidalter(intphonenumber1,char*name1); voidinsert(intphonenumber); ~Cperson();private: intphonenumber;//電話號碼 intlastdate;//充值日期 char*name;//用戶姓名 Addressaddress;//用戶地址 std::stringpostnumber;//用戶所在地的郵政編碼 doublebalance;//余額 doubletime;//通話時間 staticdoubleprice;//話費單價 staticunsignedintn;//用戶總人數};#endif//Address類的實現#include"Address.h"#include<string>usingnamespacestd;Address::Address(stringprovince,stringcity,stringstreet){province=province; city=city; street=street;}Address::getaddress(stringprovince,stringcity,stringstreet){address=province+city+street;}Address::~Address(){}Address::Address(Address&address1){province=vince; city=address1.city; street=address1.street;}//Cperson類的實現#include"Address.h"#include"Cperson.h"#include<iostream>#include<string>#include<cmath>usingnamespacestd;Cperson::Cperson(){}Cperson::Cperson(intdate,intphonenumber,char*name1,Address&address1,stringpostnumber){ lastdate=date; phonenumber=phonenumber;name=newchar[strlen(name1)+1]; //申請動態內存空間 strcpy(name,name1); //字符串的賦值 Address=address1; postnumber=postnumber; balance=0; time=0; price=price;cout<<"\t#"<<name<<"iscreated"<<endl; n++;}voidCperson::record(intdate,doubleaccount){ lastdate=date;balance=balance+account; cout<<date<<"\t#"<<name<<"\t"<<account<<"\t"<<balance<<endl;}voidCperson::inputmoney(intdate,doubleaccount){ cout<<"你已經成功充值"<<account<<endl; record(date,account);}voidCperson::settle(intdate,doubletime){doubleaccount; account=floor(time*price+0.5); if(account>getbalance()) cout<<"你的話費不足,請及時繳費!"<<endl; else record(date,-account);}voidCperson::select(char*name1){for(inti=0;i<n;i++)if(strcmp(name,name1)==0) cout<<"你查找的用戶為"<<name<<endl; else cout<<"你查找的用戶不存在"<<endl;}voidCperson::input(intphonenumber,char*name1,Address&address1,stringpostnumber,doublebalance,doubletime){phonenumber=phonenumber; name=newchar[strlen(name1)+1];//為name申請動態的內存空間strlen()是查出字符串長度的函數 strcpy(name,name1);//字符串的賦值 address=address1;postnumber=postnumber; balance=balance; time=time;}voidCperson::show()const{cout<<"phonenumber="<<phonenumber<<endl; cout<<"name="<<name<<endl; cout<<"address="<<Address(province,city,street)<<endl; cout<<"postnumber="<<postnumber<<endl; cout<<"balance="<<balance<<endl; cout<<"time="<<time<<endl;}voidCperson::alter(intphonenumber1,char*name1){ Cperson*person;person=newCperson[n]; for(inti=0;i<n;i++) if(person->phonenumber==phonenumber1) cout<<"chae";// name=(*name1); else cout<<"你要修改的用戶不存在!"<<endl;//person=newCperson[n];}voidCperson::insert(intphonenumber){}Cperson::~Cperson(){delete[]name;//釋放動態內存空間}//Cperson類的測試#include"Address.h"#include"Cperson.h"#include<iostream>#include<fstream>#include<iomanip>#include<string>usingnamespacestd;doubleCperson::price=0.8;unsignedintCperson::n=1;intmain(){ intdate; doubleaccount;intlastdate; intm; intn=1; intphonenumber; charname[20];stringprovince,city,street; stringpostnumber; doublebalance; doubletime; AddressAdd;Cperson*person=newCperson[n];/*Cpersonp(12,23,"韓波","息縣","123"); cout<<"date="<<lastdate<<endl; cout<<"address="<<address<<endl;*/ for(inti=0;i<n;i++) { cout<<"請輸入第"<<i+1<<"個人的信息"<<endl; cout<<"date="; cin>>lastdate; cout<<"phonenumber="; cin>>phonenumber; cout<<"name="; cin>>name;cout<<"province="; cin>>province; cout<<"city="; cin>>city; cout<<"street="; cin>>street; Address.getaddress(province,city,street);cout<<"postnumber="; cin>>postnumber;cout<<"balance="; cin>>balance; cout<<"time="; cin>>time; person[i].input(phonenumber,name,(province,city,street),postnumber,balance,time); for(inti=0;i<n;i++) { cout<<"請輸入第"<<i+1<<"個用戶的姓名,電話號碼,地址,郵政編號"; cin>>person[i].name>>person[i].phonenumber>>person[i].address>>person[i].postnumber; } fstreamMyfile1,Myfile2;Myfile1.open("D:\\用戶信息.txt",ios::out);Myfile1<<"***********用戶信息***********"<<endl<<endl; Myfile1<<"姓名"<<"電話號碼"<<"地址"<<"郵政編碼" <<endl<<"***************************************************************"<<endl;for(i=0;i<n;i++) Myfile1<<"NO."<<setw(2)<<n+1<<""<<setw(6)<<person[i].name<<""<<person[i].phonenumber<<""<<setw(8)<<person[i].address<<""<<person[i].postnumber<<endl;Myfile1.close();cout<<"你輸入的數據為:"<<endl; cout<<"date="<<lastdate<<endl; cout<<"phonenumber="<<phonenumber<<endl;cout<<"name="<<name<<endl;cout<<"address="<<Add.getaddress(province,city,street)<<endl;cout<<"postnumber="<<postnumber<<endl;cout<<"balance="<<balance<<endl;cout<<"time="<<time<<endl;} Cpersonperson1; cout<<"********************************************"<<endl; cout<<"你要進行的操作是:"<<endl; cout<<"1:顯示"<<"\t"<<"2:查詢"
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權】 ISO/IEC TS 17021-3:2013 RU Conformity assessment - Requirements for bodies providing audit and certification of management systems - Part 3: Competence requirements for au
- 【正版授權】 IEC 61025:2006 FR-D Fault tree analysis (FTA)
- 【正版授權】 IEC 61326:2002 EN-D Electrical equipment for measurement,control and laboratory use - EMC requirements
- 【正版授權】 IEC 62037-3:2025 RLV EN Passive RF and microwave devices,intermodulation level measurement - Part 3: Measurement of passive intermodulation in coaxial connectors
- 【正版授權】 IEC 60076-8:1997 EN-D Power transformers - Part 8: Application guide
- 手術室護理記錄課件
- 2025年廣告策劃書代表方案
- 2025年重陽節敬老活動策劃方案
- 2025年元宵晚會活動的組織與策劃
- 酒店管理知識培訓課件
- 2019外研社王嫣演講稿
- 設備安裝調試記錄表
- 展廳設計布展投標方案(完整技術標)
- 臨床路徑工作總結醫院臨床路徑管理工作總結
- 2023屆廣東省普通高中數學學業水平考試試卷及答案
- 幼升小上實機考題匯總
- 2023年版接觸網工考試內部模擬題庫含答案必考點
- 新疆維吾爾自治區初中學業水平考試英語答題卡
- 電動單梁起重機(雙速)設計計算書
- 化工原理課程設計水吸收氨氣填料塔設計
- 2023年上海嘉定區行政服務中心工作人員招聘筆試參考題庫附帶答案詳解
評論
0/150
提交評論