第十八周專案1 2 動態鍊錶查詢

2021-06-28 07:25:17 字數 758 閱讀 2505

問題及**:

/*

*檔名稱:test.cpp

*完成日期:2023年1月19日

*版 本 號:v1.0

**問題描述:編寫函式void search(int x),輸出鍊錶中是否有值為x的結點。

*程式輸入:

*程式輸出:

*/#include using namespace std;

struct node

;node *head=null; //將煉表頭定義為全域性變數,以便於後面操作

void out_list(); //輸出鍊錶

void make_list2();

void search(int x); //查詢鍊錶值

int main( )

void out_list()

cout<>n;

while(n>0) //輸入若干正數建立鍊錶,輸入非正數時,建立過程結束

return;

}void search(int x)

if(a)

cout<

else

cout<

return;

}

執行結果:

知識點總結:

輸出鍊錶中是否有值為x的結點。

第十八周J專案四找出素數

問題及 檔名稱 test.cpp 作 者 郝俊宇 完成日期 2014年 12 月 28 日 版 本 號 v1.0 問題描述 輸入若干個正整數,將其中的素數輸出來。輸入描述 個數不確定的正整數 程式輸出 輸入資料中的素數,一數一行,保持原來的順序 include include using names...

第十八周專案1 3 刪除首結點

問題及 檔名稱 test.cpp 完成日期 2015年1月19日 版 本 號 v1.0 問題描述 編寫函式delete first node 刪除鍊錶中的第乙個結點。程式輸入 程式輸出 include using namespace std struct node node head null 將煉...

第十八周專案4 點和距離

問題及 檔名稱 test.cpp 完成日期 2015年1月19日 版 本 號 v1.0 問題描述 讀程式,編寫函式 程式輸入 程式輸出 include include using namespace std enum symmetricstyle 分別表示按x軸,y軸,原點對稱 struct poi...