fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 10;
  5.  
  6. int main() {
  7. int size, mt[MAX_SIZE + 1][MAX_SIZE + 1];
  8. cin >> size;
  9. for (int line = 1; line <= size; ++line) {
  10. for (int col = 1; col <= size; ++col) {
  11. cin >> mt[line][col];
  12. }
  13. }
  14. for (int line = 1; line <= size; ++line) {
  15. for (int col = line + 1; col <= size; ++col) {
  16. int aux = mt[line][col];
  17. mt[line][col] = mt[col][line];
  18. mt[col][line] = aux;
  19. //cout << mt[line][col] << " ";
  20. }
  21. //cout << "\n";
  22. }
  23. for (int line = 1; line <= size; ++line) {
  24. for (int col = 1; col <= size; ++col) {
  25. cout << mt[line][col] << " ";
  26. }
  27. cout << "\n";
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 5292KB
stdin
3
9 2 6
6 3 4
6 1 4
stdout
9 6 6 
2 3 1 
6 4 4