fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,m,k;
  6. cin>>n>>m>>k;
  7. vector < vector < int > > A(n,vector<int>(m));
  8. vector< vector<int> >::iterator row;
  9. vector<int>::iterator col;
  10.  
  11. for(int i=0;i<n;i++)
  12. {
  13. for(int j=0;j<m;j++)
  14. {
  15.  
  16. A[i][j] = j + 1 ;
  17. }
  18. }
  19. for (row = A.begin(); row != A.end(); row++) {
  20. for (col = row->begin(); col != row->end(); col++) {
  21. cout<<*col<<" ";
  22. }
  23. cout<<endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 2868KB
stdin
4 
4
6
stdout
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4