fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int tab[5][5] {};
  7. int* kopia[7][7];
  8. for(int x=0, mn=1; x<5; ++x )
  9. for(int i=0; i<5; ++i, ++mn)
  10. {
  11. tab[x][i] = mn;
  12. }
  13.  
  14. for(int x=1; x<6; ++x)
  15. for(int i=1; i<6; ++i) kopia[x][i] = &tab[x-1][i-1];
  16.  
  17. for(int x=1; x<6; ++x) kopia[0][i] = &tab[4][i-1];
  18. for(int x=1; x<6; ++x) kopia[6][i] = &tab[0][i-1];
  19. for(int x=1; x<6; ++x) kopia[i][0] = &tab[i-1][4];
  20. for(int x=1; x<6; ++x) kopia[i][6] = &tab[i-1][0];
  21. kopia[0][0] = &tab[4][4];
  22. kopia[6][6] = &tab[0][0];
  23. kopia[0][6] = &tab[4][0];
  24. kopia[6][0] = &tab[0][4];
  25.  
  26. for(int x=0; x<7; ++x )
  27. {
  28. for(int i=0; i<7; ++i)
  29. {
  30. cout << *kopia[x][i] << '\t';
  31. }
  32. cout << '\n';
  33. }
  34.  
  35. // your code goes here
  36. return 0;
  37. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:17:34: error: ‘i’ was not declared in this scope
  for(int x=1; x<6; ++x) kopia[0][i] = &tab[4][i-1];
                                  ^
prog.cpp:18:34: error: ‘i’ was not declared in this scope
  for(int x=1; x<6; ++x) kopia[6][i] = &tab[0][i-1];
                                  ^
prog.cpp:19:31: error: ‘i’ was not declared in this scope
  for(int x=1; x<6; ++x) kopia[i][0] = &tab[i-1][4];
                               ^
prog.cpp:20:31: error: ‘i’ was not declared in this scope
  for(int x=1; x<6; ++x) kopia[i][6] = &tab[i-1][0];
                               ^
stdout
Standard output is empty