daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.     int jumlah_baris;
  8.     int jumlah_kolom;
  9.  
  10.     cout << "Masukkan jumlah baris\t: ";
  11.     cin >> jumlah_baris;
  12.  
  13.     cout << "Masukkan jumlah kolom\t: ";
  14.     cin >> jumlah_kolom;
  15.  
  16.     int matriks_satu[jumlah_baris][jumlah_kolom];
  17.     int biggest_value[jumlah_baris];
  18.  
  19.     cout << endl;
  20.  
  21.     for(int i = 0; i < jumlah_baris; i++) {
  22.         int max_value = 0;
  23.         for(int j = 0; j < jumlah_kolom; j++) {
  24.             cout << "Matriks [" << i << "][" << j << "] : ";
  25.             cin >> matriks_satu[i][j];
  26.             if(matriks_satu[i][j] > max_value) {
  27.                 max_value = matriks_satu[i][j];
  28.             }
  29.         }
  30.         biggest_value[i] = max_value;
  31.         cout << endl;
  32.     }
  33.  
  34.     cout << "Matriks satu : \n" << endl;
  35.  
  36.     for(int i = 0; i < jumlah_baris; i++) {
  37.         for(int j = 0; j < jumlah_kolom; j++) {
  38.             cout << matriks_satu[i][j] << " ";
  39.         }
  40.         cout << endl;
  41.     }
  42.  
  43.     cout << "Max value setiap baris : \n" << endl;
  44.  
  45.     for(int i = 0; i < jumlah_baris; i++) {
  46.         cout << "Baris ke " << (i + 1) << " : " << biggest_value[i] << endl;
  47.     }
  48.  
  49.     cout << endl;
  50.  
  51.     return 0;
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top