第一篇博客

Welcome to the world of C++! Here, I am sure that you will have a taste of the wonder of C++. So let’s start!

Generally Speaking

C++ 是一种高级语言,它是由 Bjarne Stroustrup 于 1979年在贝尔实验室开始设计开发的。C++ 进一步扩充和完善了 C 语言,是一种面向对象的程序设计语言。C++ 可运行于多种平台上,如 Windows、MAC 操作系统以及 UNIX 的各种版本

C++ 是一种静态类型的、编译式的、通用的、大小写敏感的、不规则的编程语言,支持过程化编程、面向对象编程和泛型编程。

C++ 被认为是一种中级语言,它综合了高级语言和低级语言的特点

Vector

构造函数

1
2
3
4
5
$ vector <type> a; ## size = capacity = 0
$ vector <type> a(int n); ## size = 0 , capacity =n
$ vector <type> a(int n, type i); ## size = n , capacity =n | 赋值 : n个i
$ vector <type> a(vector <type> b); ## 复制构造函数
$ vector <type> a(vector <type> b.begin(), vector <type> b.end()); ## 复制另一vector的[begin,end)区间内容 并创建新vector

增加函数

1
2
3
4
$ vector<int>a;
$ a.push_back(1); ## 先创建元素,再拷贝或移动到容器中
$ a.emplace_back(2); ## 直接在末尾创建元素
$ a.insert(a.end(),3) ## 向迭代器指向元素前 增加一个元素

第一篇博客
http://example.com/2023/03/26/第一篇博客/
作者
黄磊
发布于
2023年3月26日
许可协议