vector

push_back()尾部追加

pop_back()删除尾部

size()

empty()

front()返回第一个元素

back()返回最后一个元素

resize(n,0)扩展到n长,为0

insert

迭代器写法

for(auto it=a.begin();it!=a.end();it++)

List:

push_front

push_back

pop_front

pop_back

front

back

size

empty

string:

find,找到返回下标,找不到返回string:npos

substr(2,3)从第2个下标截取3个值

erase(pos,len)从pos删len长度字符

stoi字符串转数字

stoll

replace(pos,len,nstr)

insert(pos,str)

find()可以找子字符串还有单个字符,后面也可以加一个下标从什么地方开始招

stack

push

top

pop

empty

size

queue

front

push

back

pop

常用函数

sort

binary_search

sqrt

pow(a,b)a的b次方

ceil向上取整

round四舍五入

floor向下取整

find(区别与string):find(begin,end,7)在区间内找

next_permutation

对int next_permutation(a,a+n)对int数组下一个排列返回true,同时数组也变了

对string,vector next_permutation(str.begin,end)

count

find_if

swap

reverse(begin,end)

关键字

指定小数点后几位fixed+setprecision()

 

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐