Advertisement
gosuodin

Ma tran chuyen vi

May 29th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #define MAX 100
  4. int main() {
  5. int a[MAX][MAX];
  6. int soDong;
  7. int soCot;
  8. cout << "NHap so dong:";
  9. cin >> soDong;
  10. cout << "nhap so cot :";
  11. cin >> soCot;
  12. for (int i = 0; i < soDong; i++) {
  13. for (int j = 0; j < soCot; j++) {
  14. cout << "Nhap a[" << i << "][" << j << "]";
  15. cin >> a[i][j];
  16. }
  17. }
  18. int b[MAX][MAX];
  19. for (int i = 0; i < soCot; i++) {
  20. for (int j = 0; j < soDong; j++) {
  21. b[i][j] = a[j][i];
  22. }
  23. }
  24. cout << "\t" << "MA TRAN BAN DAU " << endl;
  25. for (int i = 0; i < soDong; i++) {
  26. for (int j = 0; j < soCot; j++) {
  27. cout << "\t" << a[i][j];
  28. }
  29. cout << endl;
  30. }
  31. cout << "\t " << "MA TRAN CHUYEN VI " << endl;
  32. for (int i = 0; i < soCot; i++) {
  33. for (int j = 0; j < soDong; j++) {
  34. cout << "\t"<< b[i][j];
  35. }
  36. cout << endl;
  37. }
  38. system("pause>NULL");
  39. return 0;
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement