I have been trying to write code that determines if a matrix is upper triangular or not, and print it.
I have tried while loops, double for loops, nothing. Here is the mess I currently have:
int i, j;
int count = 0;
bool upper;
while (upper = true;)
{
for (i=1; i<m; i++)
{
for (j=i-1; j<n; j++)
{
if (a[i] > a[j] && a[i][j] == 0.0)
upper = true;
else if (a[i][j] != 0.0)
upper = false;
}
}
}
// cout << "Matrix is upper triangular. " << count << endl;