Question: #ifndef MATRIX _ T _ #define MATRIX _ T _ #include using std::cerr; #include / / for asset macro template Matrix::Matrix ( RowType loRow, RowType
#ifndef MATRIX
T
#define MATRIX
T
#include
using std::cerr;
#include
for asset macro
template
Matrix::Matrix
RowType loRow, RowType hiRow,ColType loCol, ColType hiCol
arrayData
new Array
V
loRow
hiRow
;
for
RowType i
loRow; i
hiRow; i
arrayData
i
new Array
V
loCol
hiCol
;
assert
arrayData
;
loRowIndex
loRow;
hiRowIndex
hiRow;
loColIndex
loCol;
hiColIndex
hiCol;
template
Matrix::Matrix
const Matrix & initMatrix
loRowIndex
initMatrix.loRowIndex;
hiRowIndex
initMatrix.hiRowIndex;
loColIndex
initMatrix.loColIndex;
hiColIndex
initMatrix.hiColIndex;
arrayData
new Array
V
initMatrix
loRowIndex, initMatrix.hiRowIndex
;
assert
arrayData
;
for
RowType i
loRowIndex; i
hiRowIndex; i
arrayData
i
new Array
V
loColIndex
hiColIndex
;
arrayData
i
initMatrix
arrayData
i
;
template
void Matrix::operator
const Matrix & initMatrix
for
RowType i
loRowIndex; i
hiRowIndex; i
delete
arrayData
i
;
delete
arrayData
;
loRowIndex
initMatrix.loRowIndex;
hiRowIndex
initMatrix.hiRowIndex;
loColIndex
initMatrix.loColIndex;
hiColIndex
initMatrix.hiColIndex;
arrayData
new Array
V
initMatrix
loRowIndex, initMatrix.hiRowIndex
;
assert
arrayData
;
for
int i
loRowIndex; i
hiRowIndex; i
arrayData
i
new Array
V
loColIndex
hiColIndex
;
arrayData
i
initMatrix
arrayData
i
;
template
Matrix::~Matrix
template
bool Matrix::outOfRange
RowType row
if
row
loRowIndex
row
hiRowIndex
cerr
Row Index"
row
out of range";
return
true
;
else
return
false
;
template
Array
V & Matrix::operator
RowType row
assert
outOfRange
row
;
return
arrayData
row
;
template
RowType Matrix::getLoRowIndex
return loRowIndex;
template
RowType Matrix::getHiRowIndex
return hiRowIndex;
template
ColType Matrix::getLoColIndex
return loColIndex;
template
ColType Matrix::getHiColIndex
return hiColIndex;
template
void Matrix::setLoRowIndex
RowType rowLo
loRowIndex
rowLo;
template
void Matrix::setHiRowIndex
RowType rowHi
hiRowIndex
rowHi;
template
void Matrix::setLoColIndex
ColType colLo
loColIndex
colLo;
template
void Matrix::setHiColIndex
ColType colHi
hiColIndex
colHi;
#endif
string getFileName
string fName;
ADD SOME CODE TO GET FILE NAME OF MATRIX DATA FROM
TXT FILE
return fName;
void openFile
string nameOf, ifstream& in
in
open
nameOf
c
str
ios::in
;
convert nameOf to c
string; try to open
if
in
file and test for unsuccessful opening
cerr
ERROR:
nameOf
endl
endl;
exit
;
ADD CODE FOR OPEN FILE FROM TXT FILE
Write Ccode to read and display D matrix from txt file using this matrix class function and also provide main cpp drive.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
