fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int w = 10, h = 10;
  8. vector<vector<char>> vvc(w);
  9. for(auto& a : vvc)
  10. a.resize(h, 'x');
  11.  
  12. char** ppc = new char*[h];
  13.  
  14. for(int i = 0; i < h; ++i)
  15. {
  16. ppc[i] = new char[w];
  17. for(int j = 0; j < w; ++j)
  18. {
  19. ppc[i][j] = vvc[i][j];
  20. }
  21. }
  22.  
  23. for(int i = 0; i < h; ++i)
  24. {
  25. for(int j = 0; j < w; ++j)
  26. {
  27. cout << ppc[i][j];
  28. }
  29. cout << endl;
  30. }
  31. }
Success #stdin #stdout 0s 3232KB
stdin
Standard input is empty
stdout
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx