算数函数
- div_t div(int ,int);
- ldiv_t ldiv(long int , long int );
int main(int args,char*argv[])
{
div_t result;
int a=23;
int b=3;
result = div(a,b);
printf("result:%d %d",result.quot,result.rem);
return 0;
}
随机数函数
- int rand(void);
- void srand(unsigned int ); 产生随机数种子,对随机数生成器初始化
int main(int args,char*argv[])
{
srand((unsigned int)time(0));
unsigned int i=0;
unsigned temp= 0;
for(;i<10;i++)
{
temp = rand()%10;
printf("%d\n",temp);
}
}
字符转数值函数
- int atoi(char const * string);
- int strtoi(char const* string ,char** point ,int num);
数学函数
- double sin(double);
- double cos(double);
- double tan(double);
- double asin(double) ;
- double acos(double);
- double atan(double);
- double sinh(double);
- double cosh(double);
- double tanh(double);
- double exp(double);
- double log(double);
- double log10(double);
- double frexp(double ,int *);
- double ldexp(double, int *);
- double modf(double,double *);
int main(int args,char* argv[])
{
double temp;
double re;
re = modf(1.9999,&temp);
printf("%f\n",re);
printf("%f\n",temp);
printf("%f\n",fmod(8.9999,2)) ;
return 0;
}
- double pow(double);
- double sqrt(double);
- double floor(double);返回不大于参数的最大整数
- double ceil(double);返回不小于参数的最小整数
- double fabs(double);返回参数的绝对值
- double fmod(double,double);
- double atof(char const *string);
- double strtod(char const8 string,char ** unused);