Dim a, b, c As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, a, b, c a = Val(a): b = Val(b): c = Val(c) If ((b ^ 2) - (4 * a * c)) < 0 Then Print #2, "I can't solve it !" Else Print #2, ((-b) + ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a) Print #2, ((-b) - ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a) End If Close #2 Close #1 End End Sub
Dim a, b, c As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, a, b, c a = Val(a): b = Val(b): c = Val(c) If ((b ^ 2) - (4 * a * c)) < 0 Then Print #2, "I can’t solve it !" ElseIf ((b ^ 2) - (4 * a * c)) = 0 Then Print #2, ((-b) + ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a) Else Print #2, ((-b) + ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a) Print #2, ((-b) - ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a) End If Close #2 Close #1 End End Sub
Dim a, b, c As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, a, b, c
a = Val(a): b = Val(b): c = Val(c)
If ((b ^ 2) - (4 * a * c)) < 0 Then
Print #2, "I can't solve it !"
Else
Print #2, ((-b) + ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a)
Print #2, ((-b) - ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a)
End If
Close #2
Close #1
End
End Sub
Dim a, b, c As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, a, b, c
a = Val(a): b = Val(b): c = Val(c)
If ((b ^ 2) - (4 * a * c)) < 0 Then
Print #2, "I can’t solve it !"
ElseIf ((b ^ 2) - (4 * a * c)) = 0 Then
Print #2, ((-b) + ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a)
Else
Print #2, ((-b) + ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a)
Print #2, ((-b) - ((b ^ 2) - (4 * a * c)) ^ 0.5) / (2 * a)
End If
Close #2
Close #1
End
End Sub