编程题 计算分段函数sign(x)的值

编程题 计算分段函数sign(x)的值
y=sign(x)=-1 x
其他人气:144 ℃时间:2019-12-01 13:01:52
优质解答
double 是双精度的浮点型数据,输出使用 %lf格式声明.
另外如果为了减少程序执行多分支流程,建议 swich case 进行分支处理,这样可以只走一个分支,而不是你现在的走三个if 分支.
switch ( ) {
case this-value:
Code to execute if == this-value
break;
case that-value:
Code to execute if == that-value
break;
...
default:
Code to execute if does not equal the value following any of the cases
break;
}
我来回答
类似推荐
请使用1024x768 IE6.0或更高版本浏览器浏览本站点,以保证最佳阅读效果。本页提供作业小助手,一起搜作业以及作业好帮手最新版!
版权所有 CopyRight © 2012-2024 作业小助手 All Rights Reserved. 手机版