欢迎来到沾花把玖的C++算法课堂!
头文件:cstring
1.memcpy()
函数原型:void *memcpy(void *desk,const void *src,sizet count);
功能:从src拷贝count个字节到dest。
2.memset()
函数原型:void *memset(void *dest,int c,sizet count);
功能:设置dest的前count个字节为字符c。
3.strcmp()
函数原型:int strcmp(const char *string1,const char *string2);
功能:返回值<0,string1小于string2;返回值=0,string1等于string2;返回值>0,string1大于 string2。
4.strcpy()
函数原型:char *strcpy(char *strDestination,const char *strSource);
功能:把源字符串strSource(包括结尾的空字符)拷贝到strDestination所指的位置。
5.strlen()
函数原型:size_t strlen(const char *string);
功能:返回string中的字符个数,不包括尾部NULL。没有指出错误的返回值。
头文件:cctype
1.isalnum()
函数原型:int isalnum(int c);
功能:测试c是否为字母或数字。
2.isalpha()
函数原型:int isalpha(int c);
功能:测试c是否为字母。
3.islower()
函数原型:int islower(int c);
功能: 测试c是否为小写字母。
4.isupper()
函数原型:int isupper(int c);
功能:测试c是否为大写字母。
5.tolower()
函数原型:int tolower(int c);
功能:将字符转换为小写字母。
6.toupper()
函数原型:int toupper(int c);
功能:将字符转换为大写字母。
头文件:cmath
1.abs()
函数原型:int abs(int n);
功能:求n的绝对值。
2.acos()
函数原型:double acos(double x);
功能:计算并返回范围在0~π弧度之间的x的反余弦值。
3.asin()
函数原型:double asin(double x);
功能:计算并返回范围在-π/2~π/2弧度之间的x的反正弦值。
4.atan()、atan2()
函数原型:double atan(double x); double atan2(double y,double x);
功能:atan返回x的反正切值,atan2返回y/x的反正切值。
5.ceil()
函数原型:double ceil(double x);
功能:对x向上取整,并以double型浮点数形式存储结果。
6.cos()
函数原型:double cos(double x);
功能:计算并返回x的余弦值(cos)。
7.exp()
函数原型:double exp(double x);
功能:计算并返回e的x次幂。
8.fabs()
函数原型:double fabs(double x);
功能:计算并返回浮点参数x的绝对值。
9.floor()
函数原型:double floor(double x);
功能: 对x向下取整,并以double型浮点数形式存储结果。
10.log()
函数原型:double log(double x);
功能:计算并返回x的自然对数。
11.log10()
函数原型:double log10(double x);
功能: 计算并返回x的以10为底的对数。
12.pow()
函数原型:double pow(double x,double y);
功能: 计算并返回x的y次幂。
13.sin()
函数原型:double sin(double x);
功能:计算并返回x的正弦值。
14.sqrt()
函数原型:double sqrt(double x);
功能:计算并返回x的平方根。
15.tan()
函数原型:double tan(double x);
功能:计算并返回x的正切值。
头文件:iostream
1.max()
函数原型:type max(type a,type b);
功能:比较a和b并返回其中较大者。
2.min()
函数原型:type min(type a,type b);
功能:比较a和b并返回其中较小者。
头文件:cstdio
1.getchar()
函数原型:int getchar(void);
功能:从stdin中读取一个字符并返回所读字符,当出现读入错误或遇到文件结尾时返回EOF。
2.gets()
函数原型:char *gets(char *buffer);
功能:从stdin中读取一行,并存储到buffer中。读入换行符('\n')但没有保存换行符。
注意:gets()不能在比赛时使用!
3.putchar()
函数原型:int putchar(int c);
功能:写一个字符到stdout中。
4.puts()
函数原型:int puts(const char *string);
功能:将string写到stdout中,用换行符('\n') 代替字符串结尾的空字符('\0')。
注意:gets()不能在比赛时使用!
5.sprintf()
函数原型:int sprintf(char *buffer,const char *format[.Argument]...);
功能:将数据格式化后写到字符串中。
6.sscanf()
函数原型: int sscanf(const char *buffer,const char *format[.Argument]...);
功能:由buffer读取字符数据并转换后存储到每个argument指定的位置中。
本文内容为小编自己汇总,内容可能会有错误或疏漏,感谢大家的提议!
记得点赞和关注哦~