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

正文內(nèi)容

c課程設(shè)計(jì)電話簿管理-資料下載頁

2024-11-13 06:56本頁面

【導(dǎo)讀】利用文本文件存儲(chǔ)電話薄數(shù)據(jù),具有添加、刪除、顯示和查詢聯(lián)系人號(hào)碼的功能。將電話薄數(shù)據(jù)和相應(yīng)的函數(shù)封裝在類中,改寫程序使之結(jié)構(gòu)化。增加記錄修改功能,能選擇修改用戶的姓名、電話。增加錄入時(shí)間的顯示及存儲(chǔ)。資料均在屏幕上顯示。類封裝成類是首先遇到的問題,我根據(jù)課程設(shè)計(jì)書上的提示,通過看書和與同學(xué)討論,最后比較清楚地明白了類的封裝方法。數(shù)都定義為公有成員,這樣可以方便類外的函數(shù)使用成員數(shù)據(jù)。只要求姓相同,全名查找要求姓和名全部相同??吹皆闯绦颍ⅠR被其擁有的函數(shù)的數(shù)量震撼了。是,看著它們由零散的函數(shù)變?yōu)檎R的類,就如同看到C語言向C++語言進(jìn)化。而在C++里面,我尚且不知如何操作。最后通過互聯(lián)網(wǎng),才算學(xué)會(huì)在C++中調(diào)用時(shí)間單元。通過這次C++的課程設(shè)計(jì),我的知識(shí)得到了鞏固,同時(shí)也學(xué)到了很多新知識(shí)。cout<<"\t\t學(xué)號(hào):0710202020姓名:曹哲"<<endl<<endl;

  

【正文】 節(jié)點(diǎn)前的那 個(gè)節(jié)點(diǎn)成為新的鏈尾 current_ptr = head_ptr。 // 使 current_ptr 指向鏈?zhǔn)? } // 從鏈表中刪除節(jié)點(diǎn) void friend_node::delete_from_middle_of_list(friend_node *previous_ptr) { // 摘下被刪除節(jié)點(diǎn) previous_ptrnext = current_ptrnext。 delete current_ptr。 // 釋放被刪除節(jié)點(diǎn)占用的內(nèi)存 current_ptr = head_ptr。 // 使 current_ptr 指向鏈?zhǔn)? } // 釋放被鏈表占用的內(nèi)存 void friend_node::delete_list() { friend_node *temp_ptr。 // 定義一指針用來作臨時(shí)存儲(chǔ) current_ptr = head_ptr。 // 使 current_ptr 指向鏈?zhǔn)? do // 遍歷鏈表 { temp_ptr = current_ptrnext。 // 使臨時(shí)指針指向被刪除節(jié)點(diǎn)的 next delete current_ptr。 // 刪除 current node 指針指向的節(jié)點(diǎn) . current_ptr = temp_ptr。 // 再使 current_ptr 指向被刪除節(jié)點(diǎn)的 next 節(jié)點(diǎn) } while(temp_ptr != NULL)。 } //修改記錄 void friend_node::modify_record(void) { int n。 char last_name1[20]。 char first_name1[15]。 char phone_num1[12]。 search_by_name()。//此時(shí) current_ptr 指向欲修改的節(jié)點(diǎn) if(current_ptr) { cout你想修改當(dāng)前記錄的哪一項(xiàng) ?。 cout\ :。 cout\ :。 cout\ :\n。 cinn。 switch(n) { case 1: cout請(qǐng)輸入新的姓 :。 cinlast_name1。 (20,39。\n39。)。 strcpy(current_ptrlast_name, last_name1)。 break。 case 2: cout請(qǐng)輸入新的名 :。 cinfirst_name1。 (15,39。\n39。)。 strcpy(current_ptrfirst_name, first_name1)。 break。 case 3: cout請(qǐng)輸入新的電話號(hào)碼 :。 cinphone_num1。 (12,39。\n39。)。 strcpy(current_ptrphone_num, phone_num1)。 break。 default: cout請(qǐng)重新選擇 !。 break。 }。 cout修改成功 !\n。 coutcurrent_ptrlast_name39。 39。current_ptrfirst_name endl。 coutcurrent_ptrphone_numendl。 getch()。 } else cout請(qǐng)重新輸入! \n。 system(cls)。 } istreamamp。 operator(istreamamp。 is,friend_nodeamp。 CTR)// { is。 is。 is。 is。 is。 is。 is。 is。 return is。 } // 寫入鏈表數(shù)據(jù)到文件 void friend_node::write_list_to_file() { ofstream outfile。 // 輸出文件指針 (由 ofstream 生成對(duì)象 outfile) (,ios::out)。 // 打開文件用于輸出數(shù)據(jù) if (outfile) // 若打開文件時(shí)未出錯(cuò) { // 即可將數(shù)據(jù)寫入文件 current_ptr = head_ptr。 // 使 current_ptr 指向鏈?zhǔn)? if(head_ptr != NULL) // 若鏈表不為空,開始向文件寫入數(shù)據(jù) { do // 遍歷鏈表 { // 向文件寫入節(jié)點(diǎn)數(shù)據(jù) outfile current_ptrlast_name endl。 outfile current_ptrfirst_name endl。 outfile current_ptrphone_num endl。 outfilenYearendl。 outfilenMonthendl。 outfilenDayendl。 outfilenHourendl。 outfilenMinuteendl。 current_ptr = current_ptrnext。 // 使 current_ptr 指向下一個(gè)節(jié)點(diǎn) } while(current_ptr != NULL)。 // 循環(huán)直至鏈表尾 } // “文件結(jié)束”的標(biāo)識(shí)將被寫入文件尾從而在讀取文件時(shí)方便知道已到達(dá)鏈表尾 ()。 // 關(guān)閉文件 } else // 若打開文件時(shí)出錯(cuò),顯示出錯(cuò)信息 { cout 打開文件出錯(cuò) !\n。 } } // 從文件中讀取鏈表數(shù)據(jù) void friend_node::load_list_from_file() // 從數(shù)據(jù)文件 中讀取數(shù)據(jù)重建鏈表處理函數(shù) { friend_node *new_rec_ptr。 ifstream infile。 // 輸入文件指針 int end_loop = 0。 (,ios::in)。 // 打開文件用于輸入 if (infile) // 若打開文件時(shí)未出錯(cuò) { // 從文件時(shí)讀入數(shù)據(jù) do { new_rec_ptr = new friend_node。 // 為節(jié)點(diǎn)分配內(nèi)存 if(new_rec_ptr != NULL) // 檢查分配時(shí)是否出錯(cuò) { // 從文件中得到 next last name (new_rec_ptrlast_name,20)。 (20,39。\n39。)。 // 若文件未讀取完,繼續(xù)取得其他數(shù)據(jù) if((strcmp(new_rec_ptrlast_name, ) != 0) amp。amp。 (strcmp(new_rec_ptrlast_name, END OF FILE) != 0)) { (new_rec_ptrfirst_name, 15)。 (20,39。\n39。)。 (new_rec_ptrphone_num, 15)。 (20,39。\n39。)。 insert_node(new_rec_ptr)。 } else // 若文件讀取結(jié)束,刪除最近生成的節(jié)點(diǎn) { // 并設(shè)置終止循環(huán)的標(biāo)記 delete new_rec_ptr。 end_loop = 1。 } } else // 若分配內(nèi)存時(shí)出錯(cuò)顯示出錯(cuò)提示 { // 設(shè)置終止循環(huán)的標(biāo)記 cout 警 告 : 內(nèi)存出錯(cuò) . 從磁盤讀取文件失敗 .\n。 end_loop = 1。 } } while(end_loop == 0)。 // 循環(huán)至 end_loop 標(biāo)記為真 . ()。 // 關(guān)閉文件 } else // 若打開文件出錯(cuò),顯示出錯(cuò)信息 { cout 沒有可用的數(shù)據(jù)存在,鏈表為空 .\n。 } } void main(void) { friend_node record。 ()。
點(diǎn)擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1