求c语言函数大全 c语言求函数值( 六 )


用法: double atan(double x);
程序例:
#include stdio.h
#include math.h
int main(void)
{
double result;
double x = 0.5;
result = atan(x);
printf("The arc tangent of %lf is %lf\n", x, result);
return(0);
}
函数名: atan2
功能: 计算Y/X的反正切值
用法: double atan2(double y, double x);
程序例:
#include stdio.h
#include math.h
int main(void)
{
double result;
double x = 90.0, y = 45.0;
result = atan2(y, x);
printf("The arc tangent ratio of %lf is %lf\n", (y / x), result);
return 0;
}
函数名: atexit
功能: 注册终止函数
用法: int atexit(atexit_t func);
程序例:
#include stdio.h
#include stdlib.h
void exit_fn1(void)
{
printf("Exit function #1 called\n");
}
void exit_fn2(void)
{
printf("Exit function #2 called\n");
}
int main(void)
{
/* post exit function #1 */
atexit(exit_fn1);
/* post exit function #2 */
atexit(exit_fn2);
return 0;
}
函数名: atof
功能: 把字符串转换成浮点数
用法: double atof(const char *nptr);
程序例:
#include stdlib.h
#include stdio.h
int main(void)
{
float f;
char *str = "12345.67";
f = atof(str);
printf("string = %s float = %f\n", str, f);
return 0;
}
函数名: atoi
功能: 把字符串转换成长整型数
用法: int atoi(const char *nptr);
程序例:
#include stdlib.h
#include stdio.h
int main(void)
{
int n;
char *str = "12345.67";
n = atoi(str);
printf("string = %s integer = %d\n", str, n);
return 0;
}
函数名: atol
功能: 把字符串转换成长整型数
用法: long atol(const char *nptr);
程序例:
#include stdlib.h
#include stdio.h
int main(void)
{
long l;
char *str = "98765432";
l = atol(lstr);
printf("string = %s integer = %ld\n", str, l);
return(0);
}
关于求c语言函数大全和c语言求函数值的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读