Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <mem.h>
  4. #include <stdlib.h>
  5.  
  6. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  7.  
  8. int main(int argc, char** argv) {
  9.     int **A, **B, **C;
  10.     int JlhBrs, JlhKlm, brs, klm;
  11.    
  12.     printf("Masukkan jumlah baris: "); scanf("%i", &JlhBrs);
  13.     printf("Masukkan jumlah kolom: "); scanf("%i", &JlhKlm);
  14.    
  15.     A=new int*[JlhBrs];
  16.     B=new int*[JlhBrs];
  17.     C=new int*[JlhBrs];
  18.    
  19.     for (brs=0; brs<JlhBrs; brs++) {
  20.         A[brs]=new int[JlhKlm];
  21.         B[brs]=new int[JlhKlm];
  22.         C[brs]=new int[JlhKlm];
  23.     }
  24.    
  25.     printf("Matrix A:\n");
  26.     for(brs=0; brs<JlhBrs; brs++) {
  27.         for(klm=0; klm<JlhKlm; klm++) {
  28.             A[brs][klm]=rand()%100;
  29.             printf("%2i ", A[brs][klm]);
  30.         }
  31.         printf("\n");
  32.     }
  33.     getch();
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement