Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. //test1.in Matrix A:
  2. 1.00 -6.00
  3. 34.00 -1644.00
  4. 803.00 -42258.00
  5. 15524.00 -831864.00
  6. 285061.00 -15355806.00
  7. 5153062.00 -278046852.00
  8.  
  9. //test2.in Matrix B:
  10. -1875.00 17976.00 485714.00 -501810.00
  11. 5370.00 409584.00 -973084.00 559740.00
  12. 291495.00 9193128.00 -64643018.00 55199850.00
  13. 6351060.00 175638624.00 -1430791544.00 1249618200.00
  14. 120491745.00 3213894936.00 -27252104806.00 23932788870.00
  15. 2200175790.00 58033455312.00 -498213904852.00 438253167540.00
  16.  
  17. //this is my coding.
  18.  
  19. #include<iostream>
  20. #include<fstream>
  21. #include<iomanip>
  22. #include<math.h>
  23.  
  24. #define M 6
  25. #define N 2
  26. #define x 6
  27. #define y 4
  28. #define MAX 100
  29.  
  30. using namespace std;
  31. void main()
  32. {
  33. double A[MAX][MAX], B[MAX][MAX];
  34. int i, j;
  35. ifstream ifp;
  36. ifp.open("test1.in", ios::in);
  37. cout << "Matrix A" << setw(40) << endl;
  38. for(i=0;i<M;i++)
  39. {
  40. for(j=0;j<N;j++)
  41. {
  42. ifp >> A[i][j];
  43. cout << setw(20) << A[i][j];
  44. }
  45. cout << endl;
  46. }
  47. ifp.close();
  48.  
  49. ifp.open("test2.in", ios::in);
  50. cout << "Matrix B" << setw(40) << endl;
  51. for(i=0;i<x;i++)
  52. {
  53. for(j=0;j<y;j++)
  54. {
  55. ifp >> B[i][j];
  56. cout << setw(20) << B[i][j];
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement