vb关于检查算数表达式的圆括号是否配对并用COUNT统计Dim count1%Private Sub Text1_KeyPress(KeyAscii As Integer)if_________="(" then count1=count1+1elseif ________=")" then _______End IfIf KeyAscii = 13 Thenif ________ then Print "
来源:学生作业帮助网 编辑:六六作业网 时间:2025/02/07 08:27:13
vb关于检查算数表达式的圆括号是否配对并用COUNT统计Dim count1%Private Sub Text1_KeyPress(KeyAscii As Integer)if_________="(" then count1=count1+1elseif ________=")" then _______End IfIf KeyAscii = 13 Thenif ________ then Print "
vb关于检查算数表达式的圆括号是否配对并用COUNT统计
Dim count1%
Private Sub Text1_KeyPress(KeyAscii As Integer)
if_________="(" then count1=count1+1
elseif ________=")" then _______
End If
If KeyAscii = 13 Then
if ________ then Print " 左右括号配对"
elseif _________ then print "左括号多于右括号"; count1;"个"
Else:Print "右括号多于左括号"; -count1; "个"
End If
End If
End Sub
在下划线上填入相应的内容
vb关于检查算数表达式的圆括号是否配对并用COUNT统计Dim count1%Private Sub Text1_KeyPress(KeyAscii As Integer)if_________="(" then count1=count1+1elseif ________=")" then _______End IfIf KeyAscii = 13 Thenif ________ then Print "
应该少了一个参数count2
下面是我的代码
Dim count1%
Dim count2%
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "(" Then
count1 = count1 + 1
ElseIf Chr(KeyAscii) = ")" Then
count2 = count2 + 1
End If
If KeyAscii = 13 Then
If count1 = count2 Then
Print " 左右括号配对"
ElseIf count1 > count2 Then
Print "左括号多于右括号"; count1; "个"
Else
Print "右括号多于左括号"; -count1; "个"
End If
End If
End Sub