1#include <iostream>
2#include <vector>
3using namespace std;
4
5typedef vector< vector<int> > Matrix;
6
7void print(Matrix& m)
8{
9 int M=m.size();
10 int N=m[0].size();
11 for(int i=0; i<M; i++) {
12 for(int j=0; j<N; j++)
13 cout << m[i][j] << " ";
14 cout << endl;
15 }
16 cout << endl;
17}
18
19
20int main()
21{
22 Matrix m = { {1,2,3,4},
23 {5,6,7,8},
24 {9,1,2,3} };
25 print(m);
26
27 //To initialize a 3 x 4 matrix with 0:
28 Matrix n( 3,vector<int>(4,0));
29 print(n);
30 return 0;
31}
32