VB程序设计,从键盘任意输入一个X的值,求以下分段函数的值:(30分): Y=X+2(X>0) Y=0(X=0) Y=X2 (X<0)

麻烦给出详细的代码 感谢

private sub command1_click()
input "x=";x
select case x
case is>=0
y=x+2
case 0
y=0
case is<0 或 otherwise
y=x-2
endselect
?"y=";y
endsub


private sub command1_click()
input "x=";x
if x>=0
y=x+2
elseif x=0
y=0
else
y=x-2
endif
?"y=";y
endsub
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答