Advertisement
Guest User

xoay mang hai chieu 90 do

a guest
Feb 17th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. using namespace std;
  5. void nhapMaTran (int arrBegin[3][3], int arrRoll[3][3])
  6. {
  7. int value = 0;
  8. for(int i = 0; i < 3; i ++)
  9. {
  10. for(int j = 0; j < 3; j++)
  11. {
  12. cout << "nhap vao phan tu o vi tri thu:" << i << "/" << j << endl;
  13. cin >> value;
  14. arrBegin[i][j] = value;
  15. arrRoll[j][2-i] = value;
  16. }
  17. }
  18. }
  19.  
  20. void xuatMaTran (int arr[3][3])
  21. {
  22. for(int i = 0; i < 3; i ++)
  23. {
  24. for(int j = 0; j < 3; j++)
  25. {
  26. cout << arr[i][j] << " ";
  27. }
  28. cout << endl;
  29. }
  30. }
  31. int main(){
  32. int arrBegin[3][3],arrRoll[3][3];
  33. nhapMaTran(arrBegin,arrRoll);
  34. cout << endl;
  35. xuatMaTran(arrBegin);
  36. cout << endl;
  37. xuatMaTran(arrRoll);
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement