MEMBUAT CONTOH-CONTOH PROGRAM MATEMATIKA SEDERHANA DENGAN VB 6.0

 
contoh 1 : Membuat Program Faktorial Dengan Vb 6.0
a.    Buatlah New Project pada software VB anda kemudian tambahkan tiga buah label, tiga commandbutton dan dua textbox pada form. Kemudian ubah properti masing-masing dan Atur form seperti pada gambar berikut :

program faktorial dengan VB 6.0
Gambar Program faktorial
b.    kemudian ketikkan code/listing/script program berikut :
Private Sub Command1_Click()
Dim a, b, i As Integer
i = 1
b = Text1.Text
For a = 1 To b
i = i * a
Next
Text2.Text = i
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub

Private Sub Command3_Click()
End
End Sub
c.     Run(F5) dan coba masukkan nilai faktorial 4 dimana 4!=1x2x3x4=24 berikut dapat anda lihat hasilnya pada gambar dibawah ini :
contoh program matematika dengan VB
Gambar Program faktorial dengan VB 6.0
 
 
 
contoh 2 : Membuat Program Penghitung Determinan dan Penjumlahan, Perkalian Matriks Berordo 2x2 dengan VB 6.0
a.    Buatlah New Project pada software VB anda kemudian tambahkan 5 buah label, tiga commandbutton, 13 textbox dan 3  optionbutton pada form. Kemudian ubah properti masing-masing dan Atur form seperti pada gambar berikut :
program matriks dan determinan dengan VB 6.0
Gambar Program Determinan, penjumlahan dan perkalian matriks dengan VB
 
b.    kemudian ketikkan code/listing/script program berikut :
Private Sub Command1_Click()
If Option2.Value = True Then
Text12.Text = Val(Text1.Text) + Val(Text8.Text)
Text11.Text = Val(Text2.Text) + Val(Text7.Text)
Text10.Text = Val(Text3.Text) + Val(Text6.Text)
Text9.Text = Val(Text4.Text) + Val(Text5.Text)
ElseIf Option3.Value = True Then
Text13.Text = (Val(Text1.Text) * Val(Text4.Text) - Val(Text2.Text) * Val(Text3.Text)) + (Val(Text8.Text) * Val(Text5.Text) - Val(Text7.Text) * Val(Text6.Text))
Else
Text12.Text = (Val(Text1.Text) * Val(Text8.Text)) + (Val(Text2.Text) * Val(Text6.Text))
Text11.Text = (Val(Text1.Text) * Val(Text7.Text)) + (Val(Text2.Text) * Val(Text5.Text))
Text10.Text = (Val(Text3.Text) * Val(Text8.Text)) + (Val(Text4.Text) * Val(Text6.Text))
Text9.Text = (Val(Text3.Text) * Val(Text7.Text)) + (Val(Text4.Text) * Val(Text5.Text))
End If
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text1.SetFocus
End Sub

Private Sub Command3_Click()
End
End Sub
c.     Silahkan run(F5) program anda coba masukkan nilai pada matriks A dan matriks B kemudian pilih salah satu option lalu tekan tombol proses,,selamat mencoba !

program aplikasi matriks dan determinan dengan VB
Gambar Program Determinan, penjumlahan dan perkalian matriks dengan VB 6.0
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

0 Response to "MEMBUAT CONTOH-CONTOH PROGRAM MATEMATIKA SEDERHANA DENGAN VB 6.0 "

Posting Komentar