Perkalian Matriks #include #include #include <stdio.h> void inputmatriks (int x[10][10], char y, int m, int n) { int i, j; for (i=0 ; i<m ; ++i) { for (j=0 ; j> x[i][j] ; } } } void tampil (int x[10][10], char y, int m, int n) { int i, j; cout << y << " = " ; for (i=0 ; i<m ; ++i) { cout << "\n" ; cout << "|" ; for (j=0 ; j
clrscr () ; int m, n, a[10][10], b[10][10], k[10][10]; cout << "baris = " ; cin >> m ; cout << "kolom = " ; cin >> n ; inputmatriks(a, 'a', m, n) ; inputmatriks(b, 'b', m, n) ; kali (m, n, a, b, k) ; tampil (a, 'a', m, n) ; tampil (b, 'b', m, n) ; cout << "K=A*B" << endl ; tampil (k, 'k', m, n) ; getch () ;
Tampil (x)
} cout << “ Y = “
Inputmatriks (x) End
F
T
i=0 ; i<m ; ++i
F
i=0 ; i<m ; ++i
F
T cout << “\n “ ; cout << “|”
End
j=0 ; j
T cout << y << "(" << i+1 << "," << j+1 << ") = " ; cin >> x[i][j]
j=0 ; j
T
F cout << x[i][j] << “ ” kali (a,b)
Start
F F
cout “baris=”; cin >> m
i=0 ; i<m ; ++i
End
T
T
j=0 ; j<m ; ++j cout “kolom=”; cin >> n
k[i][j]=0
F Inputmatriks(a)
T K[i][j]+=a[i][t]*b[i ][t]
Inputmatriks(b) kali(a,b)
tampil(a)
t=0 ; t
cout “K=A*B”
tampil(b)
tampil(k) End