中級軟件設計師問答考試卷模_擬考試題_第1頁
中級軟件設計師問答考試卷模_擬考試題_第2頁
中級軟件設計師問答考試卷模_擬考試題_第3頁
中級軟件設計師問答考試卷模_擬考試題_第4頁
全文預覽已結束

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論