网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

c语言modf函数 c语言中mod函数怎么实现?

编写c语言程序输入任意2个数输出其和、差、积、商

可以参考下面的代码:

创新互联公司是一家专注于做网站、成都做网站与策划设计,晋安网站建设哪家好?创新互联公司做网站,专注于网站建设10多年,网设计领域的专业建站公司;建站业务涵盖:晋安等地区。晋安做网站价格咨询:18982081108

#include stdio.h

void main()

{

float x,y;

char m;

printf("Please input x and y :");

scanf("%f,%f,%c",x,y,m);

switch(m)

{

case '+': printf("x+y=%f\n",x+y);break;

case '-': printf("x-y=%f\n",x-y);break;

case '*': printf("x*y=%f\n",x*y);break;

case '/': printf("x/y=%f\n",x/y);break;

}

}

扩展资料:

C语言strlen()函数:求字符串的长度

C语言strcspn():求字符串互补跨度(长度)

C语言strcmp()函数:比较两个字符串

C语言strchr()函数:字符查找函数

C语言strcat()函数:字符串连接(拼接)

C语言iscntrl()函数:判断一个字符是否为控制字符

C语言isalpha()函数:判断一个字符是否是字母

C语言isalnum()函数:判断一个字符是否是字母或者数字

C语言frexp()函数:提取浮点数的尾数和指数部分

C语言modf()函数:提取浮点数的小数和整数部分

参考资料来源:百度百科-c语言

C语言里的modf函数  怎么用??

函数名:modf

头文件:math.h

函数原型:double

modf(double

x,

double

*ipart)

函数用途:分解x,以得到x的整数和小数部分

输入参数:x

待分解的数

输出参数:ipath

x

的整数部分

返回值:x

的小数部分

实例:

#include

math.h

#include

stdio.h

int

main(void)

{

double

fraction,

integer;

double

number

=

100000.567;

fraction

=

modf(number,

integer);

printf("The

whole

and

fractional

parts

of

%lf

are

%lf

and

%lf

",number,

integer,

fraction);

return

C语言里的modf函数 怎么用??

函数名:modf

头文件:math.h

函数原型:double

modf(double

x,

double

*ipart)

函数用途:分解x,以得到x的整数和小数部分

输入参数:x

待分解的数

输出参数:ipath

x

的整数部分

返回值:x

的小数部分

实例:

#include

math.h

#include

stdio.h

int

main(void)

{

double

fraction,

integer;

double

number

=

100000.567;

fraction

=

modf(number,

integer);

printf("The

whole

and

fractional

parts

of

%lf

are

%lf

and

%lf

",number,

integer,

fraction);

return

c语言中modf函数的具体用法,包括那个地方写那变量,例如求变量n的小数部分。

modf 函数名: modf

功 能: 把数分为整数和小数 (The modf function breaks down the floating-point value x into fractional and integer parts, each of which has the same sign as x. The signed fractional portion of x is returned. The integer portion is stored as a floating-point value at intptr.

用 法: double modf(double x, double *intptr);

程序例:

#include math.h

#include stdio.h

int main(void)

{

double fraction, integer;

double number = 100000.567;

fraction = modf(number, integer);

printf("The whole and fractional parts of %lf are %lf and %lf\n",

number, integer, fraction);

return 0;

}


网站名称:c语言modf函数 c语言中mod函数怎么实现?
转载注明:http://bjjierui.cn/article/doehcgd.html

其他资讯