c语言中不同的头函数,C语言头文件中包含的函数

http://blog.csdn.net/pipisorry/article/details/38662805

math.h常用函数 int  abs   (int x);

double  acos  (double x);

double  asin  (double x);

double  atan  (double x);

double  atan2 (double y, double x);

double  atof  (const char *s);

double  ceil  (double x);

double  cos   (double x);

double  cosh  (double x);

double  exp   (double x);

double  fabs  (double x);

double  floor (double x);

double  fmod  (double x, double y);

double  frexp (double x, int *exponent);

long  labs  (long x);

double  ldexp (double x, int exponent);

double  log   (double x);

double  log10 (double x);

double  modf  (double x, double *ipart);

double  pow   (double x, double y);

double  sin   (double x);

double  sinh  (double x);

double  sqrt  (double x);

double  tan   (double x);

double  tanh  (double x);

【C++中的数学函数汇总

math.h 数学函数库,一些数学计算的公式的具体实现是放在math.h里,具体有:

1 三角函数

double sin (double); double cos (double); double tan (double);

2 反三角函数

double asin (double); 结果介于[-PI/2, PI/2] double acos (double); 结果介于[0, PI]

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

double atan2 (double, double); 反正切(整圆值), 结果介于[-PI/2, PI/2]

3 双曲三角函数 double sinh (double); double cosh (double); double tanh (double);

4 指数与对数

double exp (double);

double pow (double, double); double sqrt (double);

double log (double); 以e为底的对数

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

5 取整

double ceil (double); 取上整 double floor (double); 取下整

6 绝对值

double fabs (double);

7 标准化浮点数

double frexp (double f, int *p); 标准化浮点数, f = x * 2^p, 已知f求x, p ( x介于[0.5, 1] )

double ldexp (double x, int p); 与frexp相反, 已知x, p求f

8 取整与取余

double modf (double, double*); 将参数的整数部分通过指针回传, 返回小数部分 double fmod (double, double); 返回两参数相除的余数 source: 《C & C++ Code Capsules》

9 平方根 sqrt

stdio.h常用函数包括

int       fclose   (FILE *stream);

int       fflush   (FILE *stream);

int       fgetc    (FILE *stream);

int       fgetpos  (FILE *stream, fpos_t *pos);

char    * fgets    (char *s, int n, FILE *stream);

FILE    * fopen    (const char *path, const char *mode);

int       fprintf  (FILE *stream, const char *format, ...);

int       fputc    (int c, FILE *stream);

int       fputs    (const char *s, FILE *stream);

size_t    fread    (void *ptr, size_t size, size_t n, FILE *stream);

FILE    * freopen  (const char *path, const char *mode,

FILE *stream);

int       fscanf   (FILE *stream, const char *format, ...);

int       fseek    (FILE *stream, long offset, int whence);

int       fsetpos  (FILE *stream, const fpos_t *pos);

long      ftell    (FILE *stream);

size_t    fwrite   (const void *ptr, size_t size, size_t n,

FILE *stream);

int       printf   (const char *format, ...);

int       puts     (const char *s);

int       rename   (const char *oldname, const char *newname);

void      rewind   (FILE *stream);

int       scanf    (const char *format, ...);

stdlib.h常用函数包括

stdlib 头文件里包含了C、C++语言的一些函数

该文件包含了的C语言标准库函数的定义

stdlib.h里面定义了五种类型、一些宏和通用工具函数。类型例如size_t、wchar_t、div_t、ldiv_t和lldiv_t;宏例如EXIT_FAILURE、EXIT_SUCCESS、RAND_MAX和MB_CUR_MAX等等;常用的函数如malloc()、calloc()、realloc()、free()、system()、atoi()、atol()、rand()、srand()、exit()等等。具体的内容你自己可以打开编译器的include目录里面的stdlib.h头文件看看

int      abs    (int x);

int      atexit (atexit_t func);

double   atof   (const char *s);

int      atoi   (const char *s);

long     atol   (const char *s);

void   * bsearch(const void *key, const void *base,

size_t nelem, size_t width,

int  (*fcmp)());

void   * calloc (size_t nitems, size_t size);

div_t    div    (int numer, int denom);

void     exit   (int status);

void     free   (void *block);

char   * getenv (const char *name);

long     labs   (long x);

ldiv_t   ldiv   (long numer, long denom);

void   * malloc (size_t size);

void     qsort  (void *base, size_t nelem, size_t width,

int  (*fcmp)());

int      rand   (void);

void   * realloc(void *block, size_t size);

void     srand  (unsigned seed);

double   strtod (const char *s, char **endptr);

long     strtol (const char *s, char **endptr, int radix);

unsigned long  strtoul (const char *s, char **endptr, int radix);

int      system (const char *command);

max(a,b)        (((a) > (b)) ? (a) : (b))

min(a,b)        (((a) < (b)) ? (a) : (b))

random(num)     (rand() % (num))

randomize()     srand((unsigned)time(NULL))

string.h常用函数包括:

char * stpcpy (char *dest, const char *src);

char * strcat (char *dest, const char *src);

char * strchr (const char *s, int c);

int   strcmp (const char *s1, const char *s2);

char * strcpy (char *dest, const char *src);

size_t   strcspn (const char *s1, const char *s2);

char * strdup (const char *s);

char * strerror(int errnum);

conio.h不是C标准库中的头文件。

conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。

包含的函数

cgets(char *);

cprintf(const char *, ...);

cputs(const char *);

cscanf(const char *, ...);

inp(unsigned short);

inpw(unsigned short);

getch(void);

getche(void);

kbhit(void);

outp(unsigned short, int);

outpw(unsigned short, unsigned short);

putch(int);

ungetch(int);

void _Cdecl clreol (void);

void _Cdecl clrscr (void);

void _Cdecl delline (void);

int _Cdecl gettext (int left, int top, int right, int bottom,

void *destin);

void _Cdecl gettextinfo (struct text_info *r);

void _Cdecl gotoxy (int x, int y);

void _Cdecl highvideo (void);

void _Cdecl insline (void);

void _Cdecl lowvideo (void);

int _Cdecl movetext (int left, int top, int right, int bottom,

int destleft, int desttop);

void _Cdecl normvideo (void);

int _Cdecl puttext (int left, int top, int right, int bottom,

void *source);

void _Cdecl textattr (int newattr);

void _Cdecl textbackground (int newcolor);

void _Cdecl textcolor (int newcolor);

void _Cdecl textmode (int newmode);

int _Cdecl wherex (void);

int _Cdecl wherey (void);

void _Cdecl window (int left, int top, int right, int bottom);

har *_Cdecl cgets (char *str);

int _Cdecl cprintf (const char *format, ...);

int _Cdecl cputs (const char *str);

int _Cdecl cscanf (const char *format, ...);

int _Cdecl getch (void);

int _Cdecl getche (void);

char *_Cdecl getpass (const char *prompt);

int _Cdecl kbhit (void);

int _Cdecl putch (int c);

int _Cdecl ungetch (int ch);

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值