C/C++库函数-2020-3-8
函数名 | 函数模型 | 功能 | 返回值 | 头文件 |
---|---|---|---|---|
abs | int abs(int x) | 求整数x的绝对值 | 计算结果 | #include <stdlib.h> 或 #include <cstdlib> |
fabs | double fabs(double x) | 求x的绝对值 | 计算结果 | #include <math.h> |
islower | int islower(int ch) | 检查ch是否小写字母 | 是,返回1,否,返回0 | #include <ctype.h> 或#include<cctype |
cos | double cos(double x) | 计算cos(x) | 计算结果 | #include <math.h> |
pow | double pow(double x,double y) | 计算xy的值 | 计算结果 | #include <math.h> |
rand | int rand(void) | 产生随机数 | 随机整数 | #include <stdlib.h> 或 #include <cstdlib> |
toupper | int toupper(int ch) | 将ch字符转换成大写字母 | 与ch相应的大写字母 | #include <ctype.h> 或#include<cctype |
strlen | unsigned int strlen(char *str) | 统计字符串str中字符个数 | 返回字符个数 | #include <string.h> 或#include <string> |
max | 求最大值 | 返回最大值 | ||
min | 求最小值 | 返回最小值 |