fork download
  1. #include<iostream>
  2. using namespace std;
  3. void tranpose(int matrixA[][100], int matrixB[][100],int sizeX,int sizeY)
  4. {
  5. for (int row = 0; row < sizeY; row++)
  6. {
  7. for (int col = 0; col < sizeX; col++)
  8. matrixB[row][col] = matrixA[col][row];
  9. }
  10. cout << "the tranpose matrix A is 4*3:\n";
  11. for (int row = 0; row < sizeY; row++)
  12. {
  13. for (int col = 0; col < sizeX; col++)
  14. {
  15. cout << matrixB[row][col] << "\t";
  16. }
  17.  
  18. cout << endl;
  19. }
  20.  
  21. }
  22. int main()
  23. {
  24. int X, Y;
  25. cin >> X >> Y;
  26. int matrixA[X][Y];
  27. int matrixB[Y][X];
  28. for (int row = 0; row < X; row++)
  29. {
  30. for (int col = 0; col < Y; col++)
  31. {
  32. cout << "Enter Value of MatrixA " << row << "," << col << endl;
  33. cin >> matrixA[row][col];
  34. }
  35. }
  36. cout << "the matrix A is 3*4:\n";
  37. for (int row = 0; row < X; row++)
  38. {
  39. for (int col = 0; col < Y; col++)
  40. {
  41.  
  42. cout << matrixA[row][col] << "\t";
  43. }
  44. cout << endl;
  45. }
  46.  
  47. tranpose(matrixA, matrixB, X, Y);
  48. system("pause");
  49. return 0;
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:47:33: error: cannot convert ‘int (*)[Y]’ to ‘int (*)[100]’ for argument ‘1’ to ‘void tranpose(int (*)[100], int (*)[100], int, int)’
  tranpose(matrixA, matrixB, X, Y);
                                 ^
stdout
Standard output is empty