1、 atan double atan(double x); 计算tan-1(x)的值. 切记单位为弧度,如果想输入为度数,请转换.方法:弧度=度数*3.14159/180 double result; double x = 0.5; result = atan(x);The arc tangent of %lf is %lf, x, result); return(0);/COS cos double cos(double x); 计算cos(x)的值.余弦函数. x的单位为弧度.切记单位为弧度,如果想输入为度数,请转换.方法:弧度=度数*3.14159/180 int main(void) r
2、esult = cos(x);The cosine of %lf is %lfCOSH cosh double cosh(double x); 计算x的双曲余弦cosh(x)的值. result = cosh(x);The hyperboic cosine of %lf is %lf/EXP exp double exp(double x); 求 e 的 x 次幂 计算结果.幂的值 x 指数 double x = 4.0; result = exp(x);e raised to the power of %lf(e%lf) = %lf,x,x,result);FABS fabs double
3、fabs(double x); 求x的绝对值. float number = -1234.0; %f absolute value: %f,number, fabs(number);FLOOR floor double floor(double x); 求出不大于x的最大整数. 该整数的双精度实数 double number = 123.54; double down, up; down = floor(number); up = ceil(number);original number %10.2lf,number);number rounded down %10.2lf,down);num
4、ber rounded up %10.2lf,up);/FMOD fmod double fmod(double x,double y); 求整除x/y的余数 返回余数的双精度数.x/y的余数值. double x = 5.0, y = 2.0; result = fmod(x,y);The remainder of (%lf / %lf) is %lf, x, y, result);/FREXP frexp double frexp(double val,int *eptr); 把双精度数val分解为数字部分(尾数)x和以2为底的指数n,即val=x*2n,n存放在eptr指向的变量中. 返
5、回数字部分 x 0.5=x 且 x1 val 待分解的数 double mantissa, number; int exponent; number = 8.0; mantissa = frexp(number, &exponent);The number %lf is, number);%lf times two to the, mantissa);power of %d, exponent);LOG log double log(double x); 求logeX(e指的是以e为底),即计算x的自然对数(ln X) double x = 8.6872; result = log(x);Th
6、e natural log of %lf is %lf/MODF每天学习一个C+函数modf(2011-5-6) modf double modf(double val,double *iptr); 把双精度数val分解为整数部分和小数部分,把整数部分存到iptr指向的单元. val的小数部分 double fraction, integer; double number = 100000.567; fraction = modf(number, &integer);The whole and fractional parts of %lf are %lf and %lf,number, in
7、teger,fraction);/RAND rand int rand(void); 产生-90 到 32767 间的随机整数(0到 0x7fff 之间) 随机整数 int i;printf(Ten random numbers from 0 to 99); for(i=0; i=0. double x = 4.0, result; result = sqrt(x);The square root of %lf is %lf/TAN tan double tan(double x); 计算tan(x)的值,即计算角度x的正切数值=0 切记单位为弧度,如果想输入为度数,请转换.方法: doubl
8、e result, x; x = 0.5; result = tan(x);The tan of %lf is %lf/TANH tanh double tanh(double x); 计算x的双曲正切函数tanh(x)的值. result = tanh(x);The hyperbolic tangent of %lf is %lf/POW pow double pow(double x,double y); 计算以x为底数的y次幂,即计算xy的值. x 底数,y 幂数 double x = 2.0, y = 3.0;%lf raised to %lf is %lf, x, y, pow(x,
9、 y);/ISALPHA isalpha int isalpha(int ch); 检查ch是否是字母. 是字母或返回 1,否则返回 0.所属文件 ISCNTRL iscntrl int iscntrl(int ch); 检查ch是否控制字符(其ASCII码在0和0x1F之间,数值为 0-31). 是返回 1,否则返回 0./ISDIGIT isdigit int isdigit(int ch); 检查ch是否是数字(0-9).无范例ISGRAPH isgraph int isgraph(int ch); 检查ch是否可打印字符(其ASCII码在ox21 到 ox7E之间),不包括空格.ISL
10、OWER islower int islower(int ch); 检查ch是否小写字母(a-z).ISPRINT isprint int isprint(int ch); 检查ch是否是可打印字符(包括空格),其ASCII码在ox20到ox7E之间/ISPUNCT ispunct int ispunct(int ch); 检查ch是否是标点字符(不包括空格),即除字母,数字和空格以外的所有可打印字符.ISSPACE isspace int isspace(int ch); 检查ch是否是空格符和跳格符(控制字符)或换行符. ISUPPER isupper int isupper(int ch
11、); 检查ch是否是大写字母(A-Z).ISXDIGIT isxdigit int isxdigit(int ch); 检查ch是否是一个16进制数学字符(即0-9,或A-F,或a-f). 是返回 1,否则返回0.SYRCAT strcat char * strcat(char * str1,char * str2); 把字符串str2接到str1后面,str1最后的0被取消. str1string.h范例: char destination25; char *blank = , *c = C+, *Borland =Borland; strcpy(destination, Borland);
12、 strcat(destination, blank); strcat(destination, c);%s, destination);STRCHR strchr char * strchr(char * str,int ch);str; 找出str指向的字符串中第一次出现字符ch的位置. 返回指向该位置的指针,如找不到,则返回空指针. str 待搜索的字符串,ch 查找的字符 char string15; char *ptr, c = r strcpy(string, This is a string ptr = strchr(string, c); if (ptr)The character %c is at position:, c, ptr-string); elseThe character was not foundSTRCMP strcmp int strcmp(char * str1,char * str2); 比较两个字符串str1,str2. str1 str2,返回正数.范
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1