c++标准头文件
#include <algorithm> //STL?通用算法
#include <bitset> //STL 位集容器
#include <cctype>?????????//字符處理
#include <cerrno> //定義錯誤碼
#include <cfloat> //浮點數處理
#include <ciso646>???????? //對應各種運算符的宏
#include <climits> //定義各種數據類型最值的常量
#include <clocale> //定義本地化函數
#include <cmath> //定義數學函數
#include <complex> //復數類
#include <csignal>???????? //信號機制支持
#include <csetjmp>???????? //異常處理支持
#include <cstdarg>???????? //不定參數列表支持
#include <cstddef>???????? //常用常量
#include <cstdio> //定義輸入/輸出函數
#include <cstdlib> //定義雜項函數及內存分配函數
#include <cstring> //字符串處理
#include <ctime> //定義關于時間的函數
#include <cwchar> //寬字符處理及輸入/輸出
#include <cwctype> //寬字符分類
#include <deque> //STL 雙端隊列容器
#include <exception> //異常處理類
#include <fstream> //文件輸入/輸出
#include <functional> //STL 定義運算函數(代替運算符)
#include <limits> //定義各種數據類型最值常量
#include <list> //STL 線性列表容器
#include <locale>?????????//本地化特定信息
#include <map> //STL 映射容器
#include <memory>?????????//STL通過分配器進行的內存分配
#include<new>????????????//動態內存分配
#include <numeric>???????? //STL常用的數字操作
#include <iomanip> //參數化輸入/輸出
#include <ios> //基本輸入/輸出支持
#include <iosfwd> //輸入/輸出系統使用的前置聲明
#include <iostream> //數據流輸入/輸出
#include <istream> //基本輸入流
#include <iterator>??????? //STL迭代器
#include <ostream> //基本輸出流
#include <queue> //STL 隊列容器
#include <set> //STL 集合容器
#include <sstream> //基于字符串的流
#include <stack> //STL 堆棧容器
#include <stdexcept> //標準異常類
#include <streambuf> //底層輸入/輸出支持
#include <string> //字符串類
#include <typeinfo>??????? //運行期間類型信息
#include <utility> //STL 通用模板類
#include <valarray>??????? //對包含值的數組的操作
#include <vector> //STL 動態數組容器
?
1.#include <algorithm> //STL?通用算法
?
<algorithm>是c++特有的STL模板的算法頭文件 包含了一些特定的算法函數 包括sort(),stable_sort(),partical_sort(),nth_element()等常用的算法函數
常用的<algorithm>里的函數:
其中firtst,mid,last,mid,nth均為迭代器類型
排序默認為升序 排序范圍為[first,last) 即first至last前一位
sort(first,last)快排
stable_sort(first,last)歸并排序
partical_sort(first,mid,last)堆排序
nth_element(first,nth,last)找出第n小的元素放于nth所在的位置
min_element(first,last)尋找范圍內最小值 返回迭代器
?
max_element(first,last)尋找范圍內最大值 返回迭代器
?
2.#include <cstdio> //定義輸入/輸出函數
?
該頭文件使c++可以使用c里面的輸入輸出函數
?
總結
- 上一篇: 关于win7 升级node版本的问题。
- 下一篇: C++ —面向对象之多态的实现与应用