首页 / 速查手册 / 在线

C++参考手册

C++基础语法、STL容器与算法速查

速查手册 · 2 次 · 2026-10-04 · 分享 · 全屏
📐 基础结构
#include <iostream>引入标准输入输出
using namespace std;使用std命名空间
int main(){ return 0; }程序入口
std::cout << "x=" << x;输出
std::cin >> x;输入
const / constexpr常量/编译期常量
auto x = 1;类型推导
🧩 STL容器
vector<int> v; v.push_back(1);动态数组
map<K,V> / unordered_map<K,V>有序/哈希键值对
set<int> / unordered_set<int>有序/哈希集合
list / deque / stack / queue链表/双端队列/栈/队列
v.size() / v.empty() / v.clear()通用方法
for (auto& e : v)范围for遍历
⚙️ 常用算法
sort(v.begin(), v.end())排序
sort(v.rbegin(), v.rend())降序排序
find / count / binary_search查找/计数/二分查找
accumulate(v.begin(),v.end(),0)求和(numeric头)
reverse / unique / max_element反转/去重/最大值
lambda: [&](int a){ return a*2; }匿名函数

📖 使用说明

本页为速查表,按分类查阅。

💬 用户评论 (0)

还没有评论,快来抢沙发!

请添加微信联系我