STL list應用舉例

2021-07-14 05:59:02 字數 660 閱讀 7780

#includeusing namespace std;

#include#includeint main()

; listilist2(iv, iv + 5);

ite = find(ilist.begin(), ilist.end(), 99); //查詢99的位置

ilist.splice(ite, ilist2); //在99位置插入ilist2-->變成0 2 5 6 7 8 9 99 3 4

ilist.reverse(); //逆置 將ilist整個逆置過來

ilist.sort(); //從小到大進行排序

for (ite = ilist.begin(); ite != ilist.end(); ++ite)

cout << *ite << " ";

cout << endl;

system("pause");

return 0;

}

unique分析:

templatevoid list::unique()

//不管兩個值是否相同,兩個同時指向同乙個資料,下一次繼續先++next

next = first;

}}

Parcelable 應用舉例

首先,自定義物件必須實現parcelable,並且建立static final parcelable.creatorcreator物件 實現createfromparcel和newarray方法 自定義物件為 public static class contact implements parcel...

sed應用舉例

1,sed 3d test.txt 把test.txt中的第三行刪除 2,sed 3a hello world test.txt 在test.txt的第三行後面新增 hello world 這一行 3,sed 3i hello world test.txt 在test.txt的第三行前面面新增 he...

8 11 應用舉例

8.11 應用舉例 統計每個學生三門考試課程總成績,程式執行時,使用者輸入學生相關資訊,程式將輸出總成績 public class example8 24 catch inputmismatchexception e system.out.println name 總成績 sum system.ou...