int main(){
int matrix[4][4] = {{1,2,1,4},
{5,6,2,8},
{9,10,1,12},
{13,14,4,16}};
if (Equal(matrix))
{
cout << "True" << endl;
}
else
cout << "False" << endl;
system("pause");
return 0;
}
bool Equal(int matrix[4][4]){
int count = 0;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if (matrix[i][j] == matrix[j][i])
{
count++;
}
}
if (count == 4)
{
return true;
}
else
count = 0;
}
return false;
}
I want to make an application that returns true if any row is equal to any column.
I've tried :
int matrix[4][4] = {{1,5,9,13},
{5,6,7,8},
{9,10,11,12},
{13,14,15,16}};
returned true.
I've tried :
int matrix[4][4] = {{1,2,1,4},
{5,6,2,8},
{9,10,1,12},
{13,14,4,16}};
returned false.(it was supposed to turn right)
I will be glad if you help.