山海经是外星人写的:VB程序代码?看看有没有误?

来源:百度文库 编辑:高考问答 时间:2024/04/26 20:29:48
Private Sub Form_Load()
Dim c1 As Integer, c2 As Integer, c3 As Integer
Dim c4 As String * 1
Dim n As Integer
n = InputBox("请输入要分解的三位数", "信息输入框")
c4 = IIf(n >= 0, "+", "-")
n = Abs(n)
c3 = n Mod 10
n = n \ 10
c2 = n Mod 10
n = n \ 10
c1 = n
Print "符号:"; c4
Print "百位数:"; c1
Print "十位数:"; c2
Print "个位数:"; c3
End Sub

代码没有错。
只不过Form1的AutoReDraw属性要设为True

Private Sub Form_Load()
Dim c1 As Integer, c2 As Integer, c3 As Integer
Dim c4 As String * 1
Dim n As Integer
n = InputBox("请输入要分解的三位数", "信息输入框")
c4 = IIf(n >= 0, "+", "-")
n = Abs(n)
c3 = n Mod 10
c2 = ((n Mod 100) - (n Mod 10))/10
c1 = (n - (n Mod 100))/100
Print "符号:"; c4
Print "百位数:"; c1
Print "十位数:"; c2
Print "个位数:"; c3
End Sub

家里机器没装VB不知道可不可以,自己试下