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++.
this is the skeleton I have so far:
#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
inFile2 >> n2; int* file2contents = new int[n2*n2]; for(int i=0; i
// 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 SpaceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started