Advertisement
Guest User

Untitled

a guest
Feb 18th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. void MatrixTransposeAndFlip(int** mat, int dim)
  2. {
  3. int temp;
  4. //matrix transpose
  5. for (int i = 0; i < dim; ++i)
  6. for (int j = 0; j < i; ++j) /////////// ?אני לא יפספס ככה את האינדקס ?0:0 ?למה צריך שהשורה תהיה קטנה יותר מהעמודה
  7. {
  8. temp = mat[i][j];
  9. mat[i][j] = mat[j][i];
  10. mat[j][i] = temp;
  11. }
  12.  
  13. for (int i = 0; i < dim; ++i)////?החלק הזה לא מיותר? אחרי שהפכתי שורות לעמודות?
  14. for (int j = 0; j < dim/2; ++j)
  15. {
  16. temp = mat[i][j];
  17. mat[i][j] = mat[i][dim-j-1];
  18. mat[i][dim-j-1] = temp;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement