freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c程序設(shè)計(jì)實(shí)踐環(huán)節(jié)考核規(guī)定-資料下載頁

2025-07-07 11:44本頁面
  

【正文】 includestringusingnamespacestd。CPeople::CPeople(){18m_nAge=20。m_fSalary=m_pstrName=newchar[20]。strcpy(m_pstrName,無名氏)。}CPeople::CPeople(intage,floatsalary,char*name){m_nAge=age。m_fSalary=salary。m_pstrName=newchar[20]。strcpy(m_pstrName,name)。}CPeople::~CPeople(){if(m_pstrName!=NULL)delete[]m_pstrName。}intCPeople::GetAge()const{returnm_nAge。}voidCPeople::SetAge(intage){m_nAge=age。}floatCPeople::GetSalary()const{if(m_nAge20)return0。elseif(GetAge()60)returnm_fSalary/2。elsereturnm_fSalary。}voidCPeople::SetSalary(floatnum){m_fSalary=num。}//賦值運(yùn)算符重載的實(shí)現(xiàn)CPeopleamp。CPeople::operator=(constCPeopleamp。AnotherPeople){if(this==amp。AnotherPeople) //檢查自賦值return*this。if(m_pstrName)19delete[]m_pstrName。 //釋放原有的內(nèi)存資源m_nAge=m_fSalary=//分配新的內(nèi)存資源,并復(fù)制內(nèi)容m_pstrName=newchar[strlen()+1]。strcpy(m_pstrName,)。return*this。}//輸出運(yùn)算符重載函數(shù)的實(shí)現(xiàn)ostreamamp。operator(ostreamamp。stream,constCPeopleamp。p){stream姓名:,年齡:(),薪水:()。returnstream。}//*********************************************// 程序清單//**********************************************//測(cè)試CPeople類includeiostreamincludeusingnamespacestd。voidmain(){CPeopleZhang(65,,張飛)。coutZhangendl。//輸出對(duì)象的值CPeopleA,B。(34)。()。coutAendl。B=A。 //將對(duì)象A的值賦給對(duì)象BcoutBendl。}三、實(shí)驗(yàn)要要求按要求編寫實(shí)驗(yàn)程序,將實(shí)驗(yàn)程序調(diào)試運(yùn)行,寫出程序的運(yùn)行結(jié)果,并提交實(shí)驗(yàn)報(bào)告,寫出調(diào)試運(yùn)行的分析和體會(huì)。實(shí)驗(yàn)八文件讀寫一、實(shí)驗(yàn)?zāi)康氖煜な褂梦募幕痉椒āJ煜?biāo)準(zhǔn)流對(duì)象cin和cout的使用方法,掌握系統(tǒng)提供20的輸入操作和輸出操作函數(shù)。二、實(shí)驗(yàn)內(nèi)容簡單通訊錄:編寫一個(gè)簡單的通訊錄程序,在文件myNote中記錄朋友的姓名、年齡和電話號(hào)碼,允許用戶向其中添加信息,根據(jù)姓名查詢或顯示所有的信息。includeiostreamincludestringincludeiomanipincludefstreamusingnamespacestd。classMyFriend{private:unsignedintage。stringname。stringtelphoneNo。public:voidgetdata(){cinnameagetelphoneNo。}voiddisp(){coutleftsetw(12)namesetw(8)agesetw(12)telphoneNoendl。}stringgetname(){returnname。}}。voidoutDate(){ ifstreaminput()。MyFriendmyfriend。cout輸入數(shù)據(jù):endl。coutleftsetw(12)姓名setw(8)年齡setw(12)電話endl。((char*)amp。myfriend,sizeof(myfriend))。while(input){()。((char*)amp。myfriend,sizeof(myfriend))。}()。}21voidsearchByName(){stringsname。boolifFind=false。MyFriendmyfriend。ifstreamfile()。(0)。cout輸入要查詢的姓名:。cinsname。coutleftsetw(12)姓名setw(8)年齡setw(12)電話endl。while(((char*)amp。myfriend,sizeof(myfriend))){ if(()==sname){()。ifFind=true。break。}}。if(!ifFind)cout對(duì)不起,沒有找到!endl。()。}voidaddDate(){fstreamfile(,ios::out|ios::app)。MyFriendmyfriend。cout添加數(shù)據(jù)(姓名年齡電話):。()。((char*)amp。myfriend,sizeof(myfriend))。()。}voidmain(){intselect。do{ cout選擇(1:輸出數(shù)據(jù)2:按姓名查詢3:添加數(shù)據(jù)其他數(shù)字:退出):。cinselect。switch(select){ case1:outDate()。break。case2:searchByName()。break。case3:addDate()。break。default:break。}22}while(select==1||select==2||select==3||select==4)。}三、實(shí)驗(yàn)要求按要求編寫實(shí)驗(yàn)程序,將實(shí)驗(yàn)程序調(diào)試運(yùn)行,寫出程序的運(yùn)行結(jié)果,并提交實(shí)驗(yàn)報(bào)告,寫出調(diào)試運(yùn)行的分析和體會(huì)。23
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1