Upcoming SlideShare
×

Makalah pk

1,188 views

Published on

Pemrograman Komputer

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,188
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
20
0
Likes
1
Embeds 0
No embeds

No notes for slide

Makalah pk

1. 1. MAKALAH PEMROGRAMAN KOMPUTER 1Disusun untuk memenuhi tugas Ujian Tengah Semester Mata Kuliah Pemrogaman Komputer 1 Dosen Pengampu: Wildan Suharso. S.Si Oleh : Muhammad Sukron 10610067 JURUSAN MATEMATIKA FAKULTAS SAINS DAN TEKNOLOGIUNIVERSITAS ISLAM NEGERI MAULANA MALIK IBRAHIM MALANG 2012
2. 2. BAB I FLOWCHART1.1 Irisan, Gabungan dan Komplemen Start dipilih() as char nilai, nilai2 as integer f, g,h as string A()as string = a.Split(pecah) B()as string = b.Split(pecah) S()as string = s.Split(pecah) f = TextBox1.Text g = TextBox2.Text h = TextBox3.Text For i = 0 To Ubound(A) For j = 0 To Ubound(B) If A (i)= B (j) B A C
3. 3. B A C ListBox1.Items.Add(A (i)) for i=0 to Ubound (A) ListBox2.Items.Add(A(i)) for j = 0 to Ubound (B) for k = 0 to Ubound (A) If B(j) < > A(k)E D F
4. 4. E D F nilai = nilai + 1 If nilai > A.Length - 1 ListBox2.Items.Add(B(j)) nilai = 0 for i = 0 to Ubound (S) for j = 0 to Ubound (A)I H J
5. 5. I H J If S(i) <> A(j) Nilai2 += 1 If x > A.Length - 1 ListBox3.Items.Add(S(i)) Nilai2 = 0 Stop
6. 6. 1.2 Selection Sort irisan A dan B Start i, r , q, m, n As Integer r = ListBox1.Items.Count - 1 selec_irisan(r) As Integer For i = 0 To r Selec_irisan(i) = ListBox1.Items(i) For i = 0 To selec_irisan. length 1 m = i For q = i + 1 To selec_irisan.Length- 1M K N
7. 7. M K N If selec_ irisan (q) < selec_irisan(m) m=q If m <> i n = selec_irisan (i) selec_irisan(i) = selec_irisan(m) selec_irisan(m) = n For p = 0 To selec_irisan.Length - 1 TextBox4.AppendText(CStr(se lec_irisan(p)) & " ") Stop
8. 8. 1.3 Selection Sort Gabungan A dan B Start min, temp, y As Integer y = ListBox2.Items.Count - 1 gabunganAB(x) As Integer For i = 0 To y Selec_gabungan (i) = ListBox2.Items(i) For i = 0 To Selc_gabungn.Length-1 min = i For j = i + 1 To Selec_gabungan.Length - 1P O Q
9. 9. P O Q If Selec_gabungan (j) < Selec_gabungan (min) min = j If min <> i temp = Selec_gabungan (i) Selec_gabungan (i) = Selec_gabungan(m) Selec_gabungan (min) = temp For p= 0 To Selec_gabungan.Length -1 TextBox4.AppendText(CStr(ga Selec_gabungan (p)) & " ") Stop
10. 10. 1.4 Selection Sort komplemen A terhadap S Start km, kp, z As Integer z = ListBox3.Items.Count - 1 selec_komplemn(z) As Integer For i = 0 To z selec_komplemn (i) = ListBox3.Items(i) For i = 0 To selc_komplmn.Length-1 km = i For j = i + 1 To selec_komplemn.Length - 1 S R T
11. 11. P O Q If selec_komplemn (j) < selc_komplmn (km) km = j If km < > i kp = selec_komplemn (i) selec_komplmn (i) = selc_komplmn (km) selec_komplemn (km) = kp For p= 0 To selec_komplemn.Length -1 TextBox4.AppendText(CStr(k selec_komplemn (p)) & " ") Stop
12. 12. BAB II PESEUDOCODE2.1 Irisan For i = 0 to Ubound[A] { For j = 0 to Ubound[B] If A[i]=B[j] } }2.2 GabunganFor i = 0 to Ubound[B] { For j = 0 to Ubound[A] If B[i]< >A[j] Nilai = nilai + 1 If nilai > A.length – 1 Nilai = 0 } }2.3 KomplemenFor i = 0 to Ubound[S] {
13. 13. For j = 0 to Ubound[A] If S[i]< >A[j] Nilai2 + = 1 If nilai2 > A.length – 1 Nilai2 = 0 } }2.4 Selection Irisan For i = 0 to selec_irisan.length – 1{ m=i for q = i + 1 to selec_irisan.length – 1 if selec_irisan [q] < selec_irisan [m] m=0 if m < > i n= selec_irisan [i] selec_irisan [i] = selec_irisan [m] selec_irisan [m] = n } }
14. 14. 2.5 Selection Gabungan For i = 0 to selec_gabungan.length – 1{ min = i for j = i + 1 to selec_gabunga.length – 1 if selec_gabungan [j] < selec_gabungan [min] min = j if min < > i temp = selec_gabungan [i] selec_ gabungan [i] = selec_gabungan [min] selec_ gabungan [min] = temp } }2.6 Selection Komplemen For i = 0 to selec_komplemen.length – 1{ km = i for j = i + 1 to selec_komplemen.length – 1 if selec_komplemen [j] < selec_komplemen [km] km = j
15. 15. if km < > i kp = selec_komplemen [i] selec_komplemen [i] = selec_komplemen [km] selec_komplemen [km] = kp }}
16. 16. BAB IIITAMPILAN APLIKASI
17. 17. BAB IV SOURCEPublic Class Form1 Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click Dim dipilih() As Char = {".", ",", "*", " "} Dim f, g, h As String Dim nilai, nilai2 As Integer nilai = 0 nilai2 = 0 f = TextBox1.Text g = TextBox2.Text h = TextBox3.Text Dim A() As String = f.Split(dipilih) Dim B() As String = g.Split(dipilih) Dim S() As String = h.Split(dipilih) irisan For i = 0 To UBound(A) For j = 0 To UBound(B) If A(i) = B(j) Then ListBox1.Items.Add(A(i)) End If Next Next gabungan For i = 0 To UBound(A) ListBox2.Items.Add(A(i)) Next For i = 0 To UBound(B) For j = 0 To UBound(A) If B(i) <> A(j) Then nilai = nilai + 1 End If Next If nilai > A.Length - 1 Then ListBox2.Items.Add(B(i)) End If nilai = 0 Next komplemen
18. 18. For i = 0 To UBound(S) For j = 0 To UBound(A) If S(i) <> A(j) Then nilai2 += 1 End If Next If nilai2 > A.Length - 1 Then ListBox3.Items.Add(S(i)) End If nilai2 = 0 Next End Sub Private Sub Label13_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesLabel13.Click Refresh() TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" ListBox1.Text = "" ListBox2.Text = "" ListBox3.Text = "" End Sub Private Sub Label15_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesLabel15.Click MsgBox("muhammad sukron" + vbCrLf + "10610067") End Sub Private Sub Button2_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton2.Click sort irirsan Dim i, r, q, m, n As Integer r = ListBox1.Items.Count - 1 Dim selec_irisan(r) As Integer For i = 0 To r selec_irisan(i) = ListBox1.Items(i) Next For i = 0 To selec_irisan.Length - 1 m = i For q = i + 1 To selec_irisan.Length - 1
19. 19. If selec_irisan(q) < selec_irisan(m) Then m = q End If Next If m <> i Then n = selec_irisan(i) selec_irisan(i) = selec_irisan(m) selec_irisan(m) = n End If Next For p = 0 To selec_irisan.Length - 1 TextBox4.AppendText(" " +CStr(selec_irisan(p))) Next sort gabungan Dim min, temp, y As Integer y = ListBox2.Items.Count - 1 Dim selec_gabungan(y) As Integer For i = 0 To y selec_gabungan(i) = ListBox2.Items(i) Next For i = 0 To selec_gabungan.Length - 1 min = i For j = i + 1 To selec_gabungan.Length - 1 If selec_gabungan(j) <selec_gabungan(min) Then min = j End If Next If min <> i Then temp = selec_gabungan(i) selec_gabungan(i) = selec_gabungan(min) selec_gabungan(min) = temp End If Next For p = 0 To selec_gabungan.Length - 1 TextBox5.AppendText(" " +CStr(selec_gabungan(p))) Next sort komplemen Dim km, kp, z As Integer z = ListBox3.Items.Count - 1 Dim selec_komplemen(z) As Integer
20. 20. For i = 0 To z selec_komplemen(i) = ListBox3.Items(i) Next For i = 0 To selec_komplemen.Length - 1 km = i For j = i + 1 To selec_komplemen.Length - 1 If selec_komplemen(j) <selec_komplemen(km) Then km = j End If Next If km <> i Then kp = selec_komplemen(i) selec_komplemen(i) = selec_komplemen(km) selec_komplemen(km) = kp End If Next For p = 0 To selec_komplemen.Length - 1 TextBox6.AppendText(" " +CStr(selec_komplemen(p))) Next End SubEnd Class