用VB解下面的题,简单的逻辑运算
来源:学生作业帮 编辑:神马作文网作业帮 分类:数学作业 时间:2024/11/12 00:25:01
用VB解下面的题,简单的逻辑运算
答案正确了,接着补上分数.
答案正确了,接着补上分数.
(1)
Dim s as String
s="abcde"
If s.Substring(2, 1) = "C" Then
MsgBox("Yes")
Else
MsgBox("No")
End If
(2)
Dim x As Double
Dim y As Double
If x > 20 Then
y = x * x + 3 * x + 2
Else
If x > 0 And x < 10 Then
y = 1 / x + Math.Abs(x)
Else
If (x > 10 And x < 20) Or (x = 10 Or x = 20) Then
y = Math.Sqrt(3 * x) - 2
End If
End If
End If
Select Case x
Case x > 20
y = x * x + 3 * x + 2
Case (x > 10 And x < 20) Or (x = 10 Or x = 20)
y = 1 / x + Math.Abs(x)
Case x > 0 And x < 10
y = Math.Sqrt(3 * x) - 2
End Select
Dim s as String
s="abcde"
If s.Substring(2, 1) = "C" Then
MsgBox("Yes")
Else
MsgBox("No")
End If
(2)
Dim x As Double
Dim y As Double
If x > 20 Then
y = x * x + 3 * x + 2
Else
If x > 0 And x < 10 Then
y = 1 / x + Math.Abs(x)
Else
If (x > 10 And x < 20) Or (x = 10 Or x = 20) Then
y = Math.Sqrt(3 * x) - 2
End If
End If
End If
Select Case x
Case x > 20
y = x * x + 3 * x + 2
Case (x > 10 And x < 20) Or (x = 10 Or x = 20)
y = 1 / x + Math.Abs(x)
Case x > 0 And x < 10
y = Math.Sqrt(3 * x) - 2
End Select