I am writing code to check if matrix is symmetric or not, I have already made transpose() method. Now I want to use that transpose method in my CheckSymmetry() method body to avoid writing code for...


I am writing code to check if matrix is symmetric or not, I have already made transpose() method. Now I want to use that transpose method in my CheckSymmetry() method body to avoid writing code for transpose again. Please help in C++:


void CheckSymmetric(float a[3][3]) {
int isSymmetric = 0;
// I want to use transpose method here
for (int i = 0; i < 3;="" i++)="">
for (int j = 0; j < 3;="" j++)="">
if (a[i][j] != transpose())
isSymmetric = 1;
}
}
if (isSymmetric)
cout < "the="" matrix="" is="" symmetric.\n="">
else
cout < "the="" matrix="" is="" not="" symmetric.\n="">
}


void Transpose(float a[3][3]) {
float transpose[3][3];


for (int i = 0; i < 3;="">
for (int j = 0; j < 3;="" ++j)="">
transpose[j][i] = a[i][j];
}
// Printing the transpose
cout < "\ntranspose="" of="" matrix:="" "=""><>
display(transpose);
}



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here