Advertisement
ApelMerah

G

Dec 15th, 2018
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void printMap(char map[][100], int maxRow, int maxCol) {
  5.     for (int i = 0; i < maxRow; i++) {
  6.         for (int j = 0; j < maxCol; j++) {
  7.             if (map[i][j] == NULL) break;
  8.             cout << map[i][j];
  9.             // cout << i << ", " << j << ": " << map[i][j] << endl;
  10.         }
  11.         cout << endl;
  12.     }
  13. }
  14.  
  15. int main() {
  16.     int m, n;
  17.    
  18.     do {
  19.         cin >> m >> n;
  20.        
  21.         char map[m][n] = { NULL };
  22.        
  23.         for (int i = 0; i < m; i++) {
  24.             for (int j = 0; j < n; j++) {
  25.                 cin >> map[m][n];
  26.             }
  27.         }
  28.        
  29.         printMap(map, m, n);
  30.     } while (m != 0);
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement