If you order your custom term paper from our custom writing service you will receive a perfectly written assignment on I don't really have one. What we need from you is to provide us with your detailed paper instructions for our experienced writers to follow all of your specific writing requirements. Specify your order details, state the exact number of pages required and our custom writing professionals will deliver the best quality I don't really have one paper right on time.
Out staff of freelance writers includes over 120 experts proficient in I don't really have one, therefore you can rest assured that your assignment will be handled by only top rated specialists. Order your I don't really have one paper at affordable prices!
#includeiostream
#includefstream
#includecstdlib
using namespace std;
//Constant Declarations
//---------------------------
const int MAXROWS = 5;
const int MAXCOLS = 5;
//Function Prototypes
//-------------------------
void Input(double a[][MAXCOLS], int& row, int& col, ifstream& fin);
void Output(double a[][MAXCOLS], int row, int col, ofstream& fout);
bool Equal(double a[][MAXCOLS], int aRow, int aCol,
double b[][MAXCOLS], int bRow, int bCol);
void Add(double a[][MAXCOLS], int aRow, int aCol,
double b[][MAXCOLS], int bRow, int bCol,
double sum[][MAXCOLS]);
void Transpose(double a[][MAXCOLS], int row, int col, double trans[][MAXCOLS]);
void Multiply(double a[][MAXCOLS], int aRow, int aCol,
double b[][MAXCOLS], int bRow, int bCol,
double product[][MAXCOLS]);
char getOp();
int main()
{
//Variable List
//----------------
char inFile1[5];
char inFile[5];
char outFile[5];
ifstream fin1;
ofstream fout;
ifstream fin;
double array1[MAXROWS][MAXCOLS] = {{0}};
int a1_Rows = 0;
int a1_Cols = 0;
int a_Rows = 0;
int a_Cols = 0;
double array[MAXROWS][MAXCOLS] = {{0}};
double product[MAXROWS][MAXCOLS] = {{0}};
double sum[MAXROWS][MAXCOLS] = {{0}};
double trans[MAXROWS][MAXCOLS] = {{0}};
char ans;
bool t;
cout Enter the name of the file that contains first set of data-;
cin inFile1;
cout endl;
cout Enter the name of the file that contains the second set of data-;
cin inFile;
cout endl;
cout Enter the name of the output file that you would like to write to-;
cin outFile;
cout endl;
fin1.open(inFile1);
if(fin1.fail())
{
cout Cannot open inFile1 program exiting endl;
exit(1);
}
fin.open(inFile);
if(fin.fail())
{
cout Cannot open inFile program exiting endl;
exit(1);
}
fout.open(outFile);
if(fout.fail())
{
cout Cannot open outFile program exiting endl;
exit(1);
}
Input(array1, a1_Rows, a1_Cols, fin1);
cout Array 1 Input [DONE] endl;
Input(array, a_Rows, a_Cols, fin);
cout Array Input [DONE] endl;
cout endl;
ans = getOp();
while (ans != q)
{
switch(ans)
{
case 1
Multiply(array1, a1_Rows, a1_Cols, array, a_Rows, a_Cols, product);
Output(array1, a1_Rows, a1_Cols, fout);
fout
fout endl;
Output(array, a_Rows, a_Cols, fout);
fout =
fout endl;
Output(product, a1_Rows, a_Cols, fout);
fout --------------------------------------------
cout Outputted to File [DONE] endl;
ans = getOp();
break;
case
Add(array1, a1_Rows, a1_Cols, array, a_Rows, a_Cols, sum);
Output(array1, a1_Rows, a1_Cols, fout);
fout +
fout endl;
Output(array, a_Rows, a_Cols, fout);
fout =
fout endl;
Output(sum, a1_Rows, a_Cols, fout);
cout Outputted to File [DONE] endl;
fout --------------------------------------------
ans = getOp();
break;
case
Transpose(array1, a1_Rows, a1_Cols, trans);
Output(array1, a1_Rows, a1_Cols, fout);
fout T =
fout endl;
Output(trans, a1_Rows, a1_Cols, fout);
cout Outputted to File [DONE] endl;
fout --------------------------------------------
ans = getOp();
break;
case 4
Transpose(array, a_Rows, a_Cols, trans);
Output(array1, a1_Rows, a1_Cols, fout);
fout T =
fout endl;
Output(trans, a1_Rows, a1_Cols, fout);
cout Outputted to File [DONE] endl;
fout --------------------------------------------
ans = getOp();
break;
case 5
Output(array1, a1_Rows, a1_Cols, fout);
fout Equals
fout endl;
Output(array, a_Rows, a_Cols, fout);
t = Equal(array1, a1_Rows, a1_Cols, array, a_Rows, a_Cols);
if (t == 1)
fout True endl;
else
fout False endl;
fout endl;
cout Outputted to File [DONE] endl;
fout --------------------------------------------
ans = getOp();
break;
default
cout Incorrect input, plase try again-;
cin ans;
cout endl;
}
}
//Closing All Input/Output Files
//-------------------------------------
fin1.close();
fin.close();
fout.close();
return(0);
}
void Input(double a[][MAXCOLS], int& row, int& col, ifstream& fin)
{
int tempRow, tempCol;
double tempVal;
fin tempRow;
fin tempCol;
for(int i = 0; i tempRow; i++)
{
for(int j = 0; j tempCol; j++)
{
fin tempVal;
a[i][j] = tempVal;
}
}
row = tempRow;
col = tempCol;
}
void Output(double a[][MAXCOLS], int row, int col, ofstream& fout)
{
int count = 0;
for(int r = 0; r row; r++)
{
for(int c = 0; c col; c++)
{
if(a[r][c] == 0)
count++;
}
}
if (count != (row col))
{
for(int i = 0; i row; i++)
{
for(int j = 0; j col; j++)
{
fout a[i][j] ;
}
fout endl;
}
fout endl;
}
else
fout Could Not Be Solved endl;
}
bool Equal(double a[][MAXCOLS], int aRow, int aCol,
double b[][MAXCOLS], int bRow, int bCol)
{
bool equalityFlag = true;
if( (aRow != bRow) || (aCol != bCol) )
equalityFlag = false;
else
{
for(int i = 0; i aRow ; i++)
{
for(int j = 0; j aCol; j++)
{
if(a[i][j] != b[i][j])
equalityFlag = false;
}
}
}
return(equalityFlag);
}
void Add(double a[][MAXCOLS], int aRow, int aCol,
double b[][MAXCOLS], int bRow, int bCol,
double sum[][MAXCOLS])
{
if ( (aRow == bRow) && (aCol == bCol))
{
for(int i = 0; i aRow; i++)
{
for(int j = 0; j aCol; j++)
{
sum[i][j] = a[i][j] + b[i][j];
}
}
}
else
{
cout endl;
cout CANNOT ADD THESE MATRICES, DIMENSIONS DONT MATCH endl;
cout endl;
}
}
void Transpose(double a[][MAXCOLS], int row, int col, double trans[][MAXCOLS])
{
if(row == col)
{
for(int i = 0; i row; i++)
{
for(int j = 0; j col; j++)
{
trans[i][j] = a[j][i];
}
}
}
else {
cout endl;
cout CANNOT TRANSPOSE, INDICES NEED TO FORM A PERFECT SQUARE endl;
cout endl;
}
}
void Multiply(double a[][MAXCOLS], int aRow, int aCol,
double b[][MAXCOLS], int bRow, int bCol,
double product[][MAXCOLS])
{
double sum = 0;
if( (aRow == bCol) && (bRow == aCol) )
{
for(int row = 0; row aRow; row++)
{
for(int col = 0; col bRow; col ++)
{
sum = 0;
for(int i = 0; i aCol; i++)
{
sum = sum + (a[row][i] b[i][col]);
}
product[row][col] = sum;
}
}
}
else{
cout endl;
cout CANNOT MULTIPLY, INDICES ARE NOT CONSISTENT endl;
cout endl;
}
}
char getOp()
{
char ans;
cout MATRIX OPERATIONS endl;
cout ------------------------------ endl;
cout 1. Multiply Matrix 1 and Matrix endl;
cout . Add Matrix 1 and Matrix endl;
cout . Transpose Matrix 1 endl;
cout 4. Transpose Matrix endl;
cout 5. See if Matrix 1 equals Matrix endl;
cout endl;
cout endl;
cout Please choose number of what you would like to do (q for quit)-;
cin ans;
cout endl;
return ans;
}
Please note that this sample paper on I don't really have one is for your review only. In order to eliminate any of the plagiarism issues, it is highly recommended that you do not use it for you own writing purposes. In case you experience difficulties with writing a well structured and accurately composed paper on I don't really have one, we are here to assist you. Your cheap custom college paper on I don't really have one will be written from scratch, so you do not have to worry about its originality.
Order your authentic assignment and you will be amazed at how easy it is to complete a quality custom paper within the shortest time possible!