Upload presentasi
Presentasi sedang didownload. Silahkan tunggu
Diterbitkan olehLiani Irawan Telah diubah "6 tahun yang lalu
1
Contoh Aplikasi Array Sorting (Bubble Sort)
2
Algoritma Bubble Sort #include < iostream.h> #include < conio.h> #include <iomanip.h> void main() { int i, j, temp, jumdata;
3
Lanjutan for (i=0; i<jumdata-1; i++) for (j=i+1; j<jumdata; j++) if (data[i] > data[j] { temp = data[i]; data[i] = data[j]; data[j] = temp; }
4
Contoh (2) #include <stdio.h> void main() { int i, j, k, barisA, kolomA, kolomB; int matrikA[100][100], matrikB[100][100], matrikC[100][100];
5
printf (“Baris Matriks A = “); scanf (“%d”, &barisA); printf (“Kolom Matriks A = “); scanf (“%d”, &kolomA); printf (“\n”); printf (“Kolom Matriks B = “); scanf (“%d”, &kolomB); /* Data Matriks A */ for (i=0; i<barisA; i++) for (j=0; j<kolomA; j++) { printf (“A (%3d, %3d)”, i+1, j+1); scanf (“%d”, &matrikA[i][j]); } printf (“\n”);
6
/* Data Matriks B */ for (i=0; i<barisA; i++) for (j=0; j<kolomB; j++) { printf (“B (%3d, %3d)”, i+1, j+1); scanf (“%d”, &matrikB[i][j]); } printf (“\n”);
7
/. Perkalian Matriks A dan B
/* Perkalian Matriks A dan B */ for (i=0; i<barisA; i++) { for (k=0; k<kolomB; k++) matrikC [i][k] = 0; for (j=0; j<kolomA; j++) matrikC[i][j] += matrikA[i][j] * matrikB[j][k]; }
Presentasi serupa
© 2024 SlidePlayer.info Inc.
All rights reserved.