makalah pk

23
MAKALAH PEMROGRAMAN KOMPUTER 1 Disusun untuk memenuhi tugas Ujian Tengah Semester Mata Kuliah Pemrogaman Komputer 1 Dosen Pengampu: Wildan Suharso. S.Si Oleh : Muhammad Sukron 10610067

Upload: syucron-katsiir

Post on 29-Jun-2015

907 views

Category:

Entertainment & Humor


0 download

DESCRIPTION

Pemrograman Komputer

TRANSCRIPT

Page 1: Makalah pk

MAKALAH PEMROGRAMAN KOMPUTER 1

Disusun untuk memenuhi tugas Ujian Tengah Semester Mata Kuliah Pemrogaman Komputer 1

Dosen Pengampu:Wildan Suharso. S.Si

Oleh :

Muhammad Sukron 10610067

JURUSAN MATEMATIKAFAKULTAS SAINS DAN TEKNOLOGI

UNIVERSITAS ISLAM NEGERI MAULANA MALIK IBRAHIM MALANG

Page 2: Makalah pk

dipilih() as charnilai, nilai2 as integerf, g,h as stringA()as string = a.Split(pecah)B()as string = b.Split(pecah)S()as string = s.Split(pecah)

For i = 0 To Ubound(A)

f = TextBox1.Textg = TextBox2.Texth = TextBox3.Text

For j = 0 To Ubound(B)

If A (i)= B (j)

A

Start

B C

2012BAB I

FLOWCHART

1.1 Irisan, Gabungan dan Komplemen

Page 3: Makalah pk

B C

DE F

for i=0 to Ubound (A)

ListBox1.Items.Add(A (i))

ListBox2.Items.Add(A(i))

A

for j = 0 to Ubound (B)

for k = 0 to Ubound (A)

If B(j) < > A(k)

Page 4: Makalah pk

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)

DE F

HI JI

Page 5: Makalah pk

If x > A.Length - 1

ListBox3.Items.Add(S(i))

Nilai2 = 0

Stop

Nilai2 += 1

If S(i) <> A(j)

HI J

Page 6: Makalah pk

Selec_irisan(i) = ListBox1.Items(i)

For i = 0 To selec_irisan. length 1

m = i

For q = i + 1 To selec_irisan.Length- 1

KM N

Start

i, r , q, m, n As Integerr = ListBox1.Items.Count - 1selec_irisan(r) As Integer

For i = 0 To r

1.2 Selection Sort irisan A dan B

Page 7: Makalah pk

For p = 0 To selec_irisan.Length - 1

TextBox4.AppendText(CStr(selec_irisan(p)) & " ")

Stop

If selec_ irisan (q) < selec_irisan(m)

m = q

K

If m <> i

n = selec_irisan (i)selec_irisan(i) = selec_irisan(m)selec_irisan(m) = n

M N

Page 8: Makalah pk

Selec_gabungan (i) = ListBox2.Items(i)

For i = 0 To Selc_gabungn.Length-1

min = i

For j = i + 1 To Selec_gabungan.Length - 1

O Q

Start

min, temp, y As Integery = ListBox2.Items.Count - 1gabunganAB(x) As Integer

For i = 0 To y

1.3 Selection Sort Gabungan A dan B

P

Page 9: Makalah pk

For p= 0 To Selec_gabungan.Length - 1

TextBox4.AppendText(CStr(ga Selec_gabungan (p)) & " ")

Stop

If Selec_gabungan (j) < Selec_gabungan (min)

min = j

O

If min <> i

temp = Selec_gabungan (i)Selec_gabungan (i) = Selec_gabungan(m)Selec_gabungan (min) = temp

P Q

Page 10: Makalah pk

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

R T

Start

km, kp, z As Integerz = ListBox3.Items.Count - 1selec_komplemn(z) As Integer

For i = 0 To z

S

1.4 Selection Sort komplemen A terhadap S

Page 11: Makalah pk

For p= 0 To selec_komplemn.Length - 1

TextBox4.AppendText(CStr(k selec_komplemn (p)) & " ")

Stop

If selec_komplemn (j) < selc_komplmn (km)

km = j

O

If km < > i

kp = selec_komplemn (i)selec_komplmn (i) = selc_komplmn (km)selec_komplemn (km) = kp

P Q

Page 12: Makalah pk

BAB II

PESEUDOCODE

2.1 Irisan

For i = 0 to Ubound[A] {

For j = 0 to Ubound[B]

If A[i]=B[j]

}

}

2.2 Gabungan

For 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 Komplemen

For i = 0 to Ubound[S] {

Page 13: Makalah pk

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

}

}

Page 14: Makalah pk

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

Page 15: Makalah pk

if km < > i

kp = selec_komplemen [i]

selec_komplemen [i] = selec_komplemen [km]

selec_komplemen [km] = kp

}

}

Page 16: Makalah pk

BAB III

TAMPILAN APLIKASI

Page 17: Makalah pk

BAB IV

SOURCE

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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

Page 18: Makalah pk

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 As System.Object, ByVal e As System.EventArgs) Handles Label13.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 As System.Object, ByVal e As System.EventArgs) Handles Label15.Click MsgBox("muhammad sukron" + vbCrLf + "10610067") End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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

Page 19: Makalah pk

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

Page 20: Makalah pk

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