January 2017
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Calendar Calendar


bai giai phuong trinh bang visual basic

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down

bai giai phuong trinh bang visual basic

Bài gửi  thanhxuan on Mon Jan 14, 2013 8:46 pm

dang cung rot ko dang cung rot???/ Question Question Question Question Question Question Question Smile Smile Smile
tha` dang di rot cho zui...... confused


Private Sub Command1_Click()
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
Dim delta As Long
Dim delta2 As Long
Dim k As Long
Dim kl As String
a = Val(Text3.Text)
b = Val(Text4.Text)
c = Val(Text5.Text)
d = Val(Text6.Text)
k = Val(Text11.Text)
delta2 = Val(Text12.Text)

If a = 0 And b = 0 And c = 0 And d = 0 Then
kl = "Phuong trinh co vo so nghiem"
X1 = ""
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
ElseIf a = 0 And b = 0 And c = 0 And d <> 0 Then
kl = "phöông trình voâ nghieäm"
X1 = ""
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
ElseIf a = 0 And b = 0 And c <> 0 Then
kl = "phuong trinh co 1 nghiem duy nhat"
X1 = Val(-d / c)
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
End If
If a = 0 And b <> 0 And c <> 0 Then
delta = c * c - 4 * b * d
End If
If a = 0 And b <> 0 And c <> 0 And delta < 0 Then
kl = "Phuong trinh vo nghiem"
X1 = ""
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
ElseIf a = 0 And b <> 0 And c <> 0 And delta = 0 Then
kl = "Phuong trinh co 1 nghiem kep"
X1 = Val(-c / (2 * b))
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
ElseIf a = 0 And b <> 0 And c <> 0 And delta > 0 Then
kl = "Phuong trinh co 2 nghiem phan biet"
X1 = Val((-c + Sqr(delta)) / (2 * b))
X2 = Val((-c - Sqr(delta)) / (2 * b))
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
End If
If a <> 0 Then
delta2 = Val(b * b - 3 * a * c)
Text12.Text = delta2
End If
If delta2 <> 0 And a <> 0 Then
k = Val((9 * a * b * c) - (2 * b * b * b) - (27 * a * a * d)) / Sqr(Abs(delta2 * delta2 * delta2))
Text11.Text = k
End If
If a <> 0 And delta2 > 0 Then
kl = "Phuong trinh co 3 nghiem"
X1 = Val(((2 * Sqr(delta2) * Cos(((Atn(-k / Sqr(Abs(k * k) + 1))) + (2 * Atn(1))) / 3)) - b) / (3 * a))
X2 = Val(((2 * Sqr(delta2) * Cos((((Atn(-k / Sqr(Abs(k * k) + 1))) + (2 * Atn(1))) / 3)) - ((2 * 3.1457) / 3)) - b) / (3 * a))
X3 = Val(((2 * Sqr(delta2) * Cos((((Atn(-k / Sqr(Abs(k * k) + 1))) + (2 * Atn(1))) / 3)) + ((2 * 3.1457) / 3)) - b) / (3 * a))
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
ElseIf a <> 0 And delta2 > 0 And Abs(k) > 1 Then
kl = "Phuong trinh co 1 nghiem duy nhat"
X1 = Val((((Sqr(delta2) * Abs(k)) / (3 * a * k)) * ((Abs(k) + Sqr(k * k - 1)) ^ (1 / 3) + (Abs(k) - Sqr(k * k - 1)) ^ (1 / 3))) - (b / (3 * a)))
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
End If
If a <> 0 And delta2 = 0 Then
kl = "Phuong trinh co 1 nghiem boi" '(((can bac ba))))'
X1 = Val((-b + (b * b * b - 27 * a * a * d) ^ 1 / 3) / (3 * a))
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3
End If
If a <> 0 And delta2 < 0 Then
kl = "Phuong trinh co 1 nghiem duy nhat" '(((can bac ba)))'
X1 = Val((Sqr(Abs(delta2)) / (3 * a)) * ((Abs(k + Sqr(k * k + 1)) ^ (1 / 3)) + (Abs(k - Sqr(k * k + 1)) ^ (1 / 3))))
X2 = ""
X3 = ""
Text7.Text = kl
Text8.Text = X1
Text9.Text = X2
Text10.Text = X3

End If
End Sub


Private Sub Command2_Click()
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub

Private Sub Command3_Click()
MsgBox "Are you sure""yes/no"
End
EPrivate Sub Command5_Click()
If (giaiphuongtrinhbac3.nghiem1.Text <> "") Then
xemnghiem.nghiem1.Text = giaiphuongtrinhbac3.nghiem1.Text
xemnghiem.nghiem2.Text = giaiphuongtrinhbac3.nghiem2.Text
xemnghiem.nghiem3.Text = giaiphuongtrinhbac3.nghiem3.Text
Else
xemnghiem.nghiem1.Text = "Chua co de bai, ban phai nhap vao da !"
xemnghiem.nghiem2.Text = "Hay nhap cac he so roi bam nut Tim x !"
xemnghiem.nghiem3.Text = "Bay gio ban hay bam Close de quay lai !"
End If
xemnghiem.Show 1
End Subnd Sub

thanhxuan

Tổng số bài gửi : 27
Join date : 03/11/2012
Age : 24
Đến từ : tra vinh

Xem lý lịch thành viên

Về Đầu Trang Go down

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết