fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int t[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  5.  
  6.  
  7. int main() {
  8. int tc[3][3] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
  9. for (int i = 0 ; i < 3 ; i++) {
  10. for (int j = 0 ; j < 3 ; j++) {
  11. tc[i][j] = t[j][i];
  12. }
  13. }
  14. for (int i = 0 ; i < 3 ; i++) {
  15. for (int j = 0 ; j < 3 ; j++) {
  16. cout << tc[i][j] << " ";
  17. }
  18. cout << "\n";
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
1 4 7 
2 5 8 
3 6 9