Advertisement
mohamed_wagdy12

Untitled

Apr 26th, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1.  
  2. /*
  3. University : HTI
  4. CodeName : Write a program to get summation of two matrix
  5. SubjectName : Programming Structure
  6. SubjectCode : csc121
  7. Group : https://www.facebook.com/groups/1421186571334814
  8. event : Ready to final
  9. */
  10.  
  11. #include "stdafx.h"
  12. #include "iostream"
  13.  
  14. using namespace std;
  15.  
  16. int main(void)
  17. {
  18.  
  19. float x[2][2], y[2][2];
  20.  
  21. // Insert [x] Matrix
  22. for(int i = 0; i < 2; i++)
  23. {
  24. for(int n = 0; n < 2; n++)
  25. {
  26. cout << "X[" << (i+1) << "][" << (n+1) << "]= ";
  27. cin >> x[i][n];
  28. }
  29. }
  30.  
  31. // Insert [y] Matrix
  32. for(int i = 0; i < 2; i++)
  33. {
  34. for(int n = 0; n < 2; n++)
  35. {
  36. cout << "Y[" << (i+1) << "][" << (n+1) << "]= ";
  37. cin >> y[i][n];
  38. }
  39. }
  40.  
  41. // print matrix
  42. for(int i = 0; i < 2; i++)
  43. {
  44. for(int n = 0; n < 2; n++)
  45. {
  46. cout << " " << x[i][n] + y[i][n] << " ";
  47. }
  48. cout << endl;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement