Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //test1.in Matrix A:
- 1.00 -6.00
- 34.00 -1644.00
- 803.00 -42258.00
- 15524.00 -831864.00
- 285061.00 -15355806.00
- 5153062.00 -278046852.00
- //test2.in Matrix B:
- -1875.00 17976.00 485714.00 -501810.00
- 5370.00 409584.00 -973084.00 559740.00
- 291495.00 9193128.00 -64643018.00 55199850.00
- 6351060.00 175638624.00 -1430791544.00 1249618200.00
- 120491745.00 3213894936.00 -27252104806.00 23932788870.00
- 2200175790.00 58033455312.00 -498213904852.00 438253167540.00
- //this is my coding.
- #include<iostream>
- #include<fstream>
- #include<iomanip>
- #include<math.h>
- #define M 6
- #define N 2
- #define x 6
- #define y 4
- #define MAX 100
- using namespace std;
- void main()
- {
- double A[MAX][MAX], B[MAX][MAX];
- int i, j;
- ifstream ifp;
- ifp.open("test1.in", ios::in);
- cout << "Matrix A" << setw(40) << endl;
- for(i=0;i<M;i++)
- {
- for(j=0;j<N;j++)
- {
- ifp >> A[i][j];
- cout << setw(20) << A[i][j];
- }
- cout << endl;
- }
- ifp.close();
- ifp.open("test2.in", ios::in);
- cout << "Matrix B" << setw(40) << endl;
- for(i=0;i<x;i++)
- {
- for(j=0;j<y;j++)
- {
- ifp >> B[i][j];
- cout << setw(20) << B[i][j];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement