Blog Lê Trung Hiếu

Just another WordPress.com site

Ôn tập tin thi học kì







Bắt đầu chuẩn bị đề cương ôn tập tin.Vừa làm vừa share….

22/05 : 2 bài

Bài 1:Đổi độ phút giây sang radian


B1:Tạo 1 form (Add/Form),1 module (Add/Module)
B2:Code
Form code :
Private Sub CmdThoat_Click()
Unload Me
End Sub
Private Sub CmdTinh_Click()
Dim goc As Double
Dim kqrad As Double
goc = Val(TxtGoc.Text)
kqrad = DomsRad(goc)
TxtRad.Text = kqrad
End Sub

Module code
Public Function Pi() As Double
Pi = 4 * Atn(1)
End Function
Public Function DomsRad(goc As Double) As Double
Dim D As Integer, m As Integer, s As Integer
D = Fix(goc)
m = Fix((goc – D) * 100)
s = ((goc – D) * 100 – m) * 100
DomsRad = (D + m / 60 + s / 3600) * Pi() / 180
End Function

Bài 2: Giao hội cạnh


B1:Tạo 1 form (Add/Form),1 module (Add/Module)
B2:Code
Form code :
Private Sub CmdThoat_Click()
Unload Me
End Sub
Private Sub CmdTinh_Click()
Dim Xa As Double, Ya As Double, Xb As Double, Yb As Double
Dim a As Double, b As Double
Dim Xc As Double, Yc As Double
Xa = Val(TxtXa.Text)
Ya = Val(TxtYa.Text)
Xb = Val(TxtXb.Text)
Yb = Val(TxtYb.Text)
a = Val(Txta.Text)
b = Val(Txtb.Text)
GiaoHoiCanh Xa, Ya, Xb, Yb, a, b, Xc, Yc
TxtXc.Text = Xc
TxtYc.Text = Yc
End Sub
Module code
Public Function Pi() As Double
Pi = 4 * Atn(1)
End Function
Public Function TKC(X1 As Double, Y1 As Double, X2 As Double, Y2 As Double) As Double
TKC = Sqr((X2 – X1) ^ 2 + (Y2 – Y1) ^ 2)
End Function
Public Function TPV(Xa As Double, Ya As Double, Xb As Double, Yb As Double) As Double
Dim Dy As Double, Dx As Double, Anfa As Double
Dy = Yb – Ya
Dx = Xb – Xa
If Dx = 0 Then
If Dy > 0 Then
TPV = Pi() / 2
Else
TPV = 3 * Pi() / 2
End If
Else
Anfa = Atn(Dy / Dx)
If (Dx > 0) And (Dy > 0) Then TPV = Anfa
If (Dx 0) Then TPV = Pi() + Anfa
If (Dx 0) And (Dy < 0) Then TPV = 2 * Pi + Anfa
End If
End Function

Public Sub GiaoHoiCanh(Xa As Double, Ya As Double, Xb As Double, Yb As Double, a As Double, b As Double, Xc As Double, Yc As Double)
Dim c As Double, X As Double, PVab As Double, GocA As Double
c = TKC(Xa, Ya, Xb, Yb)
X = (b ^ 2 + c ^ 2 – a ^ 2) / (2 * b * c)
GocA = ArcCosX(X)
PVab = TPV(Xa, Ya, Xb, Yb)
Xc = Xa + b * Cos(PVab + GocA)
Yc = Ya + b * Sin(PVab + GocA)
End Sub
Public Function ArcCosX(X As Double) As Double
ArcCosX = Atn(Sqr((1 – X ^ 2)) / X)
End Function

One response to “Ôn tập tin thi học kì

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: