Private Sub Command1_Click() Dim a As Single, b As Single, c As Single Dim d As Single, x1 As Single, x2 As Single a = InputBox("请输入一元二次方程的系数a") b = InputBox("请输入一元二次方程的系数b") c = InputBox("请输入一裤逗元二次方程的系数c") If a = 0 Then a = InputBox("因为a≠0,你输入的a=0,请重新输入系数a") End If d = b * b - 4 * a * c If d >= 0 Then x1 = (-b + Sqr(d)) / (2 * a) x2 = (-b - Sqr(d)) / (2 * a) Print "键枝系数为"; a; b; c; "的一元二次方程的根分别为"; x1 Print "系数为"; a; b; c; "的一元二次方程的根分别为"; x2 Else Print "此方程在实数范围内无解"胡亮卖 End If End Sub