Question: I am writing a program in c++. this is the skeleton I have so far: #include #include using namespace std; int main() { int n1,

I am writing a program in c++.

I am writing a program in c++. this is the skeleton I

have so far: #include #include using namespace std; int main() { int

this is the skeleton I have so far:

#include #include

using namespace std;

int main() { int n1, n2;

ifstream inFile1, inFile2; inFile1.open ("mat1.txt"); inFile2.open ("mat2.txt"); // cout

int x = n1; int i=0; int size = 0; for(i=1;i

int* file1contents = new int[n1*n1]; for(int i=0; i> file1contents[i*n1 + j]; } }

inFile2 >> n2; int* file2contents = new int[n2*n2]; for(int i=0; i> file2contents[i*n2 + j]; } }

// Print file contents to check it worked cout

cout

delete [] file1contents; delete [] file2contents;

inFile1.close(); inFile2.close(); return 0; }

An upper triangular matrix is a special type of matrix where all the values below the main diagonal are 0. In order to save space we can store this matrix without the zeros. For example 1 2 3 0 4 5 0 0 6 Would be stored as 1 2 3 4 5 6 We would also like to be able to work with these matrices in their compressed format, again to save space. Write a C++ program called, triMatMult.cpp,that accepts as arguments two files that contain these compressed upper triangular matrices. The program should multiply the two matrices together and then display the resulting compressed matrix in its compressed form. The names of the files will be given on the command line All matrices will be square, ie NXN All values will be integers File format o N (dimension of the matrix) o number 1 o number 2 o number 3 For help on matrix multiplication see h urplemath.com/modules/mtrkmult.htm Restrictions: You cannot expand the compressed matrices to do the multiplication. If you do this you will receive no credit for this portion of the assignment. Again the whole point is to save Space

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!