ing, int c );
附录 2 常用库函数
347
功能: 在字符串string中查找指定字符c 原型: char *strstr( const char *string, const char *strCharSet ); 功能: 在字符串中查找指定子字符串。 原型: int strcmp( const char *string1, const char *string2 ); int _stricmp( const char *string1, const char *string2 ); int strncmp( const char *string1, const char *string2, size_t count ); int _strnicmp( const char *string1, const char *string2, size_t count ); 功能: 比较两个字符串。stricmp()在比较时不区对大小写字母;strncmp()仅比较两 字符
串的前maxlen位;strnicmp()仅比较两字符串的前maxlen位,且比较时不区 分大小写字母。如果两字符串相同,则返回地否则返回非0值。 原型: size_t strlen( const char *string ); 功能: 求字符串长度。 9.数学运算库函数,原型均在头文件math.h。 原型: int abs( int n ); double fabs(double x); long labs(long x); 功能: 求绝对值。 原型: double _cabs( struct _complex z ); 功能: 求复数的模。 原型: double sin(double); double cos(double x); double tan(double x); double asin(double x); double acos(double x); double atan(double x); double atan2(double y, double x); 功能: 求三角函数和反三角函数。 原型: double sinh(double); double cosh(double x); double tanh(double x); 功能: 求双曲函数。 原型: double exp(double); double log(double x); double log10(double x); double pow(double x, double y); double sqrt(double x); 功能: 求指数、对数、幂函数和平方根。 原型: int max(int a,int b);
附录 2 常用库函数
348
int min(int a,int b); 功能: 求两数中的较大者或较小者。这两个库函数均为定义于头文件则州地 h中的带参数 的宏。 原型: double _hypot( double x, double y ); 功能: 计算直角三角形斜边的长。 10.时间函数,原型均在头文件 time.h 中。 原型: time_t time ( time_t *timer ); 功能: 取当前系统时间。其中类型 time_t(相当于long int)存放自1970年1月1日午夜起流 逝的秒数。 原型: char *ctime ( const time_t *timer ); 功能: 将以 time_t 格式存放的时间转换为相应的字符串,结果为一静态字符串的地址,其 格式形如:“Wed Jan 02 02:03:55 1980\n”。 原型: double difftime ( time_t timer1, time_t timer0 ); 功能: 求从timer0到timer1之间以秒为单位的时间间隔。 原型: struct tm *localtime ( const time_t *timer ); struct tm *gmtime( const time_t *timer ); 功能: 将以 time_t 类型表示的时间值转换为以 struct tm 格式表示的时间。struct tm 的格式
上一篇:
vc++英文文献_vc代码
下一篇:
市政公用事业管理体制创新问题研究