常用函数
来源:互联网 发布:淘宝儿童女外衣 编辑:程序博客网 时间:2024/06/03 09:32
万能头文件:#include <bits/stdc++.h>
功能:包含了目前c++所包含的所有头文件
(1)inplace_merge()函数:
参数:inplace_merge(first,mid,last,compare)
头文件:<algorithm>
时间复杂度:O(容器长度n)
前提条件:区间[first,mid),[mid,last)有序,都呈升序或降序排列
结果:一个容器内分两个有序的部分归并到本身的容器
ps:merge函数为从两个的有序列归并到其他容器;
(2)floor(),ceil()函数:
功能:下取整(即取不大于参数的最大整数),上取整(即取不小于参数的最大整数)
头文件:<math.h>
返回类型:double类型
(3)next_permunation()函数:
参数:next_permunation(a,a+3);
功能:求一个排序的下一个排列的函数
头文件:<algorithm>
简单引例:
int a[3];
a[0]=1;a[1]=2;a[2]=3;
do{
cout<<a[0]<<a[1]<<a[2]<<‘ ’;
}while(next_permunation(a,a+3));
则输出为:1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1
(4)sin()函数
参数:double sin(double x)
头文件:<math.h>
(5)pow()函数
参数:double pow(double x,double y)
头文件:<math.h>
功能:返回以x为底的y次方值
(6)oct,dec,hex函数
功能:进制转换函数
头文件:<iomanip.h>
例子:cin>>hex>>n;//输入十六进制非负整数
cout<<oct<<n<<dec<<n<<hex<<setiosflags(ios::uppercase)<<n<<endl;//输出八,十,十六进制形式
输入:1a 输出:32 26 1A
ps:setiosflags(ios::uppercase) 16进制大写输出
(7)更新中...
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- 常用函数
- MySQL 常用操作
- 数据库事物的 ACID 属性和 5 种状态
- jquery 设置、取消disabled、checked 等属性
- Git 入门
- HeapSort(堆排序)
- 常用函数
- leetcode75. Sort Colors
- java 对文件内容进行分词统计
- java 数组列表
- hdoj 1000
- jsp 指令和内置对象
- 浅谈sql中的in与not in,exists与not exists的区别
- javascript 事件冒泡机制
- Sublime text3