adrienbrody2011

Reading 2-dimensional array

Aug 18th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     int m;
  8.     cin >> n >> m;
  9.     int a[100][100];
  10.     for (int i = 0; i < n; i++) {
  11.         for (int j = 0; j < m; j++) {
  12.             cin >> a[i][j];
  13.         }
  14.     }
  15.     for (int i = 0; i < n; i++) {
  16.         for (int j = 0; j < m; j++) {
  17.             cout << a[i][j] << " ";
  18.         }
  19.         cout << "\n";
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment