> 其他 >
编写程序:求函数y的值.计算公式如下,x的值由键盘输入:


人气:282 ℃ 时间:2019-10-25 09:26:14
解答
#include
using namespace std;
double fun( double x )
{
\x05if ( x > -10 && x -5 && x 5 && x x;
\x05\x05cout 麻烦用C语言写一下#include double fun( double x ){ if ( x > -10 && x <= -5 )return x + 2; else if ( x > -5 && x <= 5 )return x; else if ( x > 5 && x <= 10 )return x - 2; return 0;}int main(){ int x; while ( 1 ) {printf("x: ");scanf("%d", &x);printf("y: %ld\n\n", fun( x ) ); } return 0;}
推荐
猜你喜欢
© 2025 79432.Com All Rights Reserved.
电脑版|手机版