Private Sub Form_Click()
Dim x As String
Dim a%,b%,c%,y%
x = InputBox("请输入三位数","提示框")
If Len(x) = 3 Then
a = Val(Mid(x,1,1))
b = Val(Mid(x,2,1))
c = Val(Mid(x,3,1))
y = Val(x)
If a ^ 3 + b ^ 3 + c ^ 3 = y Then
Print "是水仙花水"
Else
Print "不是水仙花数"
End If
Else
Print "输入错误"
End If
End Sub
两个问题:
1、在Form_Load里执行print是看不到的
2、将x定义为string类型方可