0402 Private Sub Command1_Click() Dim a As Single,b As Single Dim c As Single,d As Single Dim m A0401Private Sub Form_Load()Dim x As Long,s As Stringx = InputBox("输入一个整数(1~40000)")If x Mod 2 = 0 Thens = "偶数"Elses = "奇数"End IfMsgBo
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/14 18:13:48
![0402 Private Sub Command1_Click() Dim a As Single,b As Single Dim c As Single,d As Single Dim m A0401Private Sub Form_Load()Dim x As Long,s As Stringx = InputBox(](/uploads/image/z/13433439-39-9.jpg?t=0402+Private+Sub+Command1_Click%28%29+Dim+a+As+Single%2Cb+As+Single+Dim+c+As+Single%2Cd+As+Single+Dim+m+A0401Private+Sub+Form_Load%28%29Dim+x+As+Long%2Cs+As+Stringx+%3D+InputBox%28%22%E8%BE%93%E5%85%A5%E4%B8%80%E4%B8%AA%E6%95%B4%E6%95%B0%281%7E40000%29%22%29If+x+Mod+2+%3D+0+Thens+%3D+%22%E5%81%B6%E6%95%B0%22Elses+%3D+%22%E5%A5%87%E6%95%B0%22End+IfMsgBo)
0402 Private Sub Command1_Click() Dim a As Single,b As Single Dim c As Single,d As Single Dim m A0401Private Sub Form_Load()Dim x As Long,s As Stringx = InputBox("输入一个整数(1~40000)")If x Mod 2 = 0 Thens = "偶数"Elses = "奇数"End IfMsgBo
0402 Private Sub Command1_Click() Dim a As Single,b As Single Dim c As Single,d As Single Dim m A
0401
Private Sub Form_Load()
Dim x As Long,s As String
x = InputBox("输入一个整数(1~40000)")
If x Mod 2 = 0 Then
s = "偶数"
Else
s = "奇数"
End If
MsgBox s
End Sub
Private Sub Command1_Click()
Dim a As Single,b As Single
Dim c As Single,d As Single
Dim m As Single,n As Single,x As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
d = Val(Text4.Text)
If a > b Then
m = a
Else
m = b
End If
If c > d Then
n = c
Else
n = d
End If
If m > n Then
x = m
Else
x = n
End If
Text5.Text = x
End Sub
0402 Private Sub Command1_Click() Dim a As Single,b As Single Dim c As Single,d As Single Dim m A0401Private Sub Form_Load()Dim x As Long,s As Stringx = InputBox("输入一个整数(1~40000)")If x Mod 2 = 0 Thens = "偶数"Elses = "奇数"End IfMsgBo
你好像是查询abcd四个数的最大数,你使用的这个方法不理想,在VB中一般使用排序进行判断,排序是将数据存储在数组中,你的程序可以定义一个数组,然后进行排序:
Private Sub Command1_Click()
Dim a(1 To 4) As Single,x As Single
a(1) = Val(Text1.Text):a(2) = Val(Text2.Text):a(3) = Val(Text3.Text):a(4) = Val(Text4.Text)
For i = 1 To 3
For j = 1 To 4 - i
If a(j) < a(j + 1) Then
x = a(j)
a(j) = a(j + 1)
a(j + 1) = x
End If
Next j
Next i
Text5.Text = "最大值是:" & CStr(a(1)) & ",最小值是:" & CStr(a(4))
End Sub