VB编程 select case问题

来源:百度知道 编辑:UC知道 时间:2024/05/11 21:38:52
Select Case x
Case Is < 10
k = 1
Case 10 <= x < 20
k = 0.95
Case 20 <= x < 50
k = 0.9
Case 50 <= x < 100
k = 0.85
Case Else
k = 0.82

End Select
这种输入好像不对 电脑运行不正常,请各位大侠帮忙改改!!!
错误的 不行啊

Select Case x
Case Is < 10
k = 1
Case is < 20
k = 0.95
Case is < 50
k = 0.9
Case is < 100
k = 0.85
Case Else
k = 0.82
End Select

或者你用IF语句来实现
if x<10 then
k=10
elseif x<20 then
k=0.95
elseif x<50 then
k=0.9
elseif x<100 then
k=0.85
else
k=0.82
end if

Select Case x
Case Is < 10
k = 1
Case 10 <= x and x < 20
k = 0.95
Case 20 <=x and x < 50
k = 0.9
Case 50 <=x and x < 100
k = 0.85
Case Else
k = 0.82