求助:vb编程 输入一元二次方程的系数a,b,c的值,编程求解一元二次方程ax^(2)+bx
展开全部
Private Sub Form_Click()
Dim a, b, c, x As Integer
a = Val(InputBox("输入A"))
b = Val(InputBox("输入B"))
c = Val(InputBox("输入C"))
x = Val(InputBox("输入X"))
Print "a * x ^ 2 + b * x=";a * x ^ 2 + b * x
End Sub
Dim a, b, c, x As Integer
a = Val(InputBox("输入A"))
b = Val(InputBox("输入B"))
c = Val(InputBox("输入C"))
x = Val(InputBox("输入X"))
Print "a * x ^ 2 + b * x=";a * x ^ 2 + b * x
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim a, b, c, x As Integer
a = Val(InputBox("ÊäÈëA"))
b = Val(InputBox("ÊäÈëB"))
c = Val(InputBox("ÊäÈëC"))
If b * b - 4 * a * c < 0 Then
MsgBox "no "
Else
Print "X1 =" & (Sqr(b * b - 4 * a * c) - b) / (2 * a)
Print "X2 =" & (-Sqr(b * b - 4 * a * c) - b) / (2 * a)
End If
End Sub
Dim a, b, c, x As Integer
a = Val(InputBox("ÊäÈëA"))
b = Val(InputBox("ÊäÈëB"))
c = Val(InputBox("ÊäÈëC"))
If b * b - 4 * a * c < 0 Then
MsgBox "no "
Else
Print "X1 =" & (Sqr(b * b - 4 * a * c) - b) / (2 * a)
Print "X2 =" & (-Sqr(b * b - 4 * a * c) - b) / (2 * a)
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim a%, b%, c%, s!, x1!, x2!
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
c = Text3.Text
s = b ^ 2 - 4 * a * c
If s < 0 Then
MsgBox "无解!"
ElseIf s = 0 Then
x1 = (-b + Sqr(x)) / (2 * a)
Label1.Caption = "x" + "=" + Str(x1)
Else
x1 = (-b + Sqr(s)) / (2 * a)
x2 = (-b - Sqr(s)) / (2 * a)
Label1.Caption = "x1" + "=" + Str(x1) + vbCrLf + "x2" + "=" + Str(x2)
End If
End Sub
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
c = Text3.Text
s = b ^ 2 - 4 * a * c
If s < 0 Then
MsgBox "无解!"
ElseIf s = 0 Then
x1 = (-b + Sqr(x)) / (2 * a)
Label1.Caption = "x" + "=" + Str(x1)
Else
x1 = (-b + Sqr(s)) / (2 * a)
x2 = (-b - Sqr(s)) / (2 * a)
Label1.Caption = "x1" + "=" + Str(x1) + vbCrLf + "x2" + "=" + Str(x2)
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询