这是我的第一个脚本之一。出于某些原因,即使total
高于scored
,也会出错。
Option Explicit
Dim scored, total
scored = InputBox("How many marks did you score?","Percentage calculator:")
If IsNumeric(scored) Then
total = InputBox("What were the maximum(total) marks?", "Percentage calculator")
Else
WScript.Echo "Type a number you foolish person!"
End If
If IsNumeric(total) And total > scored Then
MsgBox "You have scored " & scored*100/total &"% marks", vbOkOnly
ElseIf Not IsNumeric(total) Or total < scored Then
MsgBox "Error!", 0+16
End If
问题是当我运行程序时,它要求我score
,我输入50然后输入100作为total
。它给了我&#34;错误!&#34;好像total
小于scored
。