下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、姓名:_ 班級:_ 學號:_-密-封 -線- 中級軟件設計師問答考試卷模_擬考試題考試時間:120分鐘 考試總分:100分題號一二三四五總分分數(shù)遵守考場紀律,維護知識尊嚴,杜絕違紀行為,確保考試結果公正。1、【說明】本程序將兩個從小到大的有序鏈表合成一個新的從小到大的有序鏈表。鏈表的每一項由類node描述,而鏈表由類list描述。類list的成員函數(shù)有以下幾個。createlist( ):創(chuàng)建從小到大的有序鏈表。multiplylist(list l1,list l2):將鏈表l1和鏈表l2合并。print( );打印鏈表。# include iostream.hclass list;clas
2、s nodefriend class list;public:node(int data)(1);private:int data;node *next;class listpublic:list( ) list = null;void multiplylist(list l1, list l2);void createlist( );void print( );private:node *list;void list:createlist( )node *p, *u, *pm;int data;list = null;while (1)cout”輸入鏈表的一項: (小于零,結束鏈表)”end
3、1;cin data;if(data0)break; /小于零,結束輸入p = list;while (p != null & data p-data) /查找插入點pre = p;p = p-next;u=(2):if(p=list)list = u;elsepre-next = u;(3):void list:multiplylist (list l1, list l2)node *pl1, *pl2, *pl, *u;list = null;pl1 = l1.list;pl2 = l2.1ist;while (pl1 != null & pl2!= null)if (pl1-data p
4、l2-data)u = new node (pl1-data);pl1 = pl1 -next;elseu = new node (pl2-data);pl2 = pl2-next;if (list=null)list=(4);elsepl-next = u;pl =u;pl1 = (pl1 != null) pl1:pl2;while (pl1 != null)u =(5);pl1 = pl1-next;if (list=null)list=pl=u;elsepl-next = u;pl = u;void list:print( )node *p;p = list;while (p != null)cout p-data “/t”;p = p-next;cout end1;void main ( )list l1, l2, l;cout “創(chuàng)建第一個鏈表/n”; l1.createlist ( );cout “創(chuàng)建第二個鏈表/n”; l2.createlist ( );l1.print
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 5.2 薪火相傳有繼承-同步課件 2024-2025學年高中政治統(tǒng)編版選擇性必修二法律與生活
- 2024-2025學年高中信息技術(信息科技)選修5 三維設計與創(chuàng)意浙教版(2019)教學設計合集
- 人教版小學數(shù)學三年級上冊8.1《分數(shù)的大小比較》教學設計
- 湘藝版音樂六下第十單元 故鄉(xiāng)戀情 教案
- 北師大版六上第七單元第7課時 百分數(shù)的應用(四) 教案
- 新概念英語第一冊Lesson90 教學設計
- 外研版(2019)必修第三冊 Unit 5 What an Adventure!教案
- 黑龍江省大慶市紅崗區(qū)大慶十中2025屆高三下學期期末聯(lián)考化學試題理試題含解析
- 汽車行駛、轉向與制動系統(tǒng)檢修 第2版 課件 武忠 項目8-10 制動系統(tǒng)的檢修、汽車行駛穩(wěn)定性系統(tǒng)檢修、電子駐車制動系統(tǒng)檢修
- 《機器學習-Python實踐》試卷及答案 卷10
- 2024二十屆三中全會知識競賽題庫及答案
- 部編人教版道德與法治五年級上冊全冊課件設計
- (高清版)JTG 5142-2019 公路瀝青路面養(yǎng)護技術規(guī)范
- 《電力建設土建工程施工技術檢驗規(guī)范》
- 統(tǒng)編版高一語文必修上冊期末復習:文言文閱讀 練習題匯編(含答案解析)
- 檔案整理及數(shù)字化服務方案
- 電梯使用單位安全風險日管控、周排查、月調(diào)度管理制度
- 人工報價單表格范本
- 《色彩基礎知識》PPT課件(詳解)
- A4橫線稿紙模板(可直接打印)-a4線條紙
- 翻車機司機理論試題及答案
評論
0/150
提交評論