fork(11) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7. char A [3][3] =
  8. {
  9. { 'a', 'b', 'c' },
  10. { 'd', 'e', 'f' },
  11. { 'g', 'h', 'i' }
  12. };
  13.  
  14. cout << "A = " << endl << endl;
  15.  
  16. // print matrix A
  17. for (int i=0; i<3; i++)
  18. {
  19. for (int j=0; j<3; j++)
  20. cout << A[i][j];
  21. cout << endl;
  22. }
  23.  
  24. cout << endl << "A transpose = " << endl << endl;
  25.  
  26. // print A transpose
  27. for (int i=0; i<3; i++)
  28. {
  29. for (int j=0; j<3; j++)
  30. cout << A[j][i];
  31. cout << endl;
  32. }
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
A = 

abc
def
ghi

A transpose = 

adg
beh
cfi