VB编程,如果一个三位整数等于其各位数字的立方和,则称这个数为水仙花数.输入一个整数判断其是否为水仙花数.

问题描述:

VB编程,如果一个三位整数等于其各位数字的立方和,则称这个数为水仙花数.输入一个整数判断其是否为水仙花数.
Private Sub Form_Load()
Dim x%,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
以上哪里错了?

Private Sub Form_Click()Dim x As StringDim a%,b%,c%,y%x = InputBox("请输入三位数","提示框")If Len(x) = 3 Thena = 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...