Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int row,col;
  6.  
  7. void replace_matrix(int a[][col])
  8. {
  9. for(int i=0;i<col;i++){
  10. for(int j=0;j<row;j++){
  11. cout<<a[j][i]<<ends;
  12. }
  13. cout<<"\n";
  14. }
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20. cin>>row>>col;
  21. int a[row][col];
  22. for(int i=0;i<row;i++){
  23. for(int j=0;j<col;j++){
  24. cin>>a[i][j];
  25. }
  26. }
  27. for(int i=0;i<row;i++){
  28. for(int j=0;j<col;j++){
  29. cout<<a[i][j]<<ends;
  30. }
  31. cout<<"\n";
  32. }
  33. replace_matrix(a);
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement