fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. const int j=3;
  7.  
  8. int** arr = new int*[5];
  9. for(int i = 0; i < 5; i++)
  10. arr[i] = new int[j];
  11.  
  12. int dx = 0;
  13. for (int g = 0; g < j; g++) {
  14. for (int t = 0; t < 5; t++) {
  15. arr[t][g]=1;
  16. }
  17. dx=g;
  18.  
  19. for (int d = 0; d <5; d++) {
  20. for (int n = 0; n < j; n++) {
  21. cout << arr[d][n] << " ";
  22. }
  23. cout << endl;
  24. }
  25. cout << endl;
  26. }
  27.  
  28. for(int i = 0; i < 5; i++)
  29. delete [] arr[i];
  30. delete [] arr;
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1 0 0 
1 0 0 
1 0 0 
1 0 0 
1 0 0 

1 1 0 
1 1 0 
1 1 0 
1 1 0 
1 1 0 

1 1 1 
1 1 1 
1 1 1 
1 1 1 
1 1 1