b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

c++ strchr函数_strchr函数返回_模拟实现strchr函数(7)

电脑杂谈  发布时间:2017-02-28 08:29:56  来源:网络整理

doubleacos (double); //结果介于[0, PI]

doubleatan (double);//反正切(主),结果介于[-PI/2,PI/2]

doubleatan2 (double, double); //反正切(整圆),结果介于

[-PI/2,PI/2]

doublesinh (double);

doublecosh (double);

doubletanh (double);

doubleexp (double);

doublepow (double a, double b); //a的b次方

doublesqrt (double);

doublelog (double); //以e为底的对数

double log10 (double);c 中自然对数函数:log(N) 以10为底:log10(N)但没有以2为底的函数但是可以用换底公式解决:log2(N)=log10(N)/log10(2)

doubleceil (double); //取上整

doublefloor (double); //取下整

doublefabs (double);

double frexp (doublef, int *p); 标准化浮点数, f = x * 2^p, 已知f

求x, p ( x介于[0.5, 1]) double ldexp (doublex, int p); 与

frexp相反, 已知x,p求f

doublemodf (double,double*);将参数的整数部分通过 指针回传, 返回小数部分

doublefmod(double,double);返回两参数相除的余数

sqrt

double hypot(doublex, double y);

#include <stdio.h>

#include <math.h>

int main(void)

{

double result;

double x = 3.0;

double y = 4.0;

result = hypot(x, y);

printf("The hypotenuse is: %lf\n",result);

return 0;

}

floor(x0.5); //解释:等于1的区间为[0.5,1.5)

strchr函数原型:extern char *strchr(const char *s,char c);查找字符串s中首次出现字符c的位置。

举例1:

#include<stdio.h>

#include<string.h>

intmain()

{

char a[17];

char *ptr,c='r';

strcpy(a,"This is a string");

ptr=strchr(a,c);

if(ptr)

printf("The character %c is atposition: %s\n",c,ptr);

else

printf("The character was notfound\n");

return 0;

}

输出结果:The character r is at position:ring

memset:作用是在一段内存块中填充某个给定的,它是对较大的结构体或数组进行清零操作的一种最快方法

函数原型:void*memset(void *s, int ch, size_t n);


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-34960-7.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...