415鍊錶聯絡(日記)

2021-08-15 19:30:43 字數 2509 閱讀 5291

#include"stdafx.h"

#include#include#includeusing namespace std;

struct student

//==操作符過載

};ostream & operator << (ostream & os, const student & x) //流物件是不能複製的,所以必須傳引用或者指標 第二個是指student物件x的引用

/*過載輸出「<<」符號,方便student結構體的輸出*/

template //申明乙個類函式

class list

}; //私有內嵌結構體,包括資料,前指標,後指標。

public:

list()

//list建構函式,呼叫私有函式init生成乙個預設的鍊錶,有頭結點,尾結點。

~list()

//析構函式

void clear()

thesize = 0;

} //將鍊錶裡面的元素全部刪除。

int size() const

//返回鍊錶的長度。

bool empty()

//判斷鍊錶是否為空。

node * locate(int i) //定位函式 返回指標位址

return p;

} }//返回第i個結點。

node * begin()

//返回第乙個結點。

node * end()

//返回尾結點。

object getlocate(int i) //定位函式 返回元素

//返回第i個結點儲存的元素。

void push_front(const object & x)

//頭插入。

void push_back(const object & x)

//尾插入。

void insert(node * p, const object & x)

//在p結點前插入新的結點,其元素為x。

int search(const object & x)

p = p->next;

} /*if( i <= size( ))

else

cout << "對不起,這個健康表不存在你要查詢的學生及其資訊,請先檢視全部學生的資訊!謝謝!!" << endl;*/

if (i <= size())

return i;

else

return -1;

} //查詢元素x在鍊錶的位置,如果不存在,返回-1

void remove(int i)

//刪除第i個結點。

void output()

cout << endl;

} //將鍊錶依次輸出。

private:

int thesize; //鍊錶的長度。

node * head; //頭結點。

node * tail; //尾結點。

void init()

//生成預設鍊錶。

};int main()

cout << "資訊已經插入完畢!" << endl;

}else

cout << "資訊已經插入完畢!" << endl;

}if (flag1 == false)

flag1 = true;

cout << endl;

} else if (m == 2)

else

cout << "對不起,這個健康表不存在你要查詢的學生及其資訊,請先檢視全部學生的資訊!謝謝!!" << endl;

cout << endl;

} else if (m == 3)

cout << endl;

} else if (m == 4)

flag = true;

write.close();

}else

cout << endl;

} else if (m == 5)

}if (flag2)

cout << "該學號的學生的資訊存在健康表!" << endl;

else

cout << "對不起,這個健康表不存在你要查詢的學生及其資訊,請先檢視全部學生的資訊!謝謝!!" << endl;

cout << endl;

} else if (m == 6)

else

cout << endl;

} else

}}20170405 晴天 nice 我去吃飯了

20170406 雨天 bad 我去睡覺了

20170407 白天 cool 我去跑步了

else if (m == 3)

cout << endl;

}

IBM實習日記 4 15

今天到ibm的時候發現樓下竟然有乙個叫做 ibm禮品網 的廠家在cdl大廳裡大張旗鼓的賣東西,鞋 t恤 包 帽子 杯子等等,一應具全。以前 一直以為這些所謂印著各大廠商logo的東西都是未授權產品,看樣子還真是錯怪了,有一些廠家,比如這家,就是授權的,還有很多ibm的員工買,我估計那 些東西就是在i...

表與表聯絡

not null create table t7 id int not null,name char not null default 預設值 年齡 性別 datetime create table t8 id int unsigned not null,name char 18 gender en...

Leetcode刷題日記之回文鍊錶

回文鍊錶 請判斷乙個鍊錶是否為回文鍊錶。示例 1 輸入 1 2輸出 false示例 2 輸入 1 2 2 1輸出 true高階 你能否用 o n 時間複雜度和 o 1 空間複雜度解決此題?首先解決這個問題的第一步,一定需要使用到快慢指標fast和slow,找到鍊錶中點,並在前進過程中將鍊錶的一半進行...