44问答网
所有问题
用c语言编写表达式并通过程序求值
2x^2+2|3x+4|+5。 当x=2时
举报该问题
推荐答案 2015-09-22
可得如下代码:
#include<stdio.h>
double fun(double x)
{
double t = 3*x+4>0?3*x+4:-3*x-4;
t*=2;
return (t+2*x*x+5);
}
int main()
{
double x, y;
scanf ("%lf", &x);
y = fun(x);
printf ("%f\n", y);
return 0;
}
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://44.wendadaohang.com/zd/YWDZGKWK63YWWYVWKGZ.html
相似回答
大家正在搜
相关问题
用c语言写出下列表达式并通过程序求值2x² 2|3...
用C语言编写程序“算术表达式求值”
C语言编写的算术表达式求值程序
C语言编一个实现简单的算术表达式求值的代码。
用C语言编写程序,计算表达式1-1/2+1/3-1/4+1/...
求一个C语言算术表达式求值程序
数据结构c语言版表达式求值标准程序
编写程序对表达式求值: