编绎错误: 类型-声明字符与声明的数据类型不符合。请教大仙,错在那里
Private Sub Form_Load()Dim a As Single, b As Single, c As Single
Dim d As Single, X1 As Single, X2 As Single
Dim q As Single, p As Single
a = Val(InputBox("请输入参数a的值"))
b = Val(InputBox("请输入参数b的值"))
c = Val(InputBox("请输入参数c的值"))
If a = 0 Then
Print "输入参数不是二次方程!"
Else
d = b * b - 4 * a * c
q = -b / (2 * a)
If d = 0 Then
Print " 方程有两个相等实数根!" + Chr(13)
Print "X1=X2=" & q
ElseIf d > 0 Then
X1 = (-b + Sqr(d)) / (2 * a)
X2 = (-b - Sqr(d)) / (2 * a)
Print "方程有两个不相等实数根" + Chr(13)
Print "X1=" & X1
Print Chr(13)
Print "X2=" & X2
Else
p = Sqr(-d) / (2 * a)
Print "方程有两个共轭复数根" + Chr(13)
Print "X1" & q&; "+" & p&; "i"
Print "X2" & q&; "-" & p&; "i"
End If
End If
End Sub