In: Computer Science
CODE
SCREENSHOTS:
OUTPUT SCREENSHOT:
CODE:
#include <bits/stdc++.h>
#define SIZE 100
using namespace std;
bool check(int m, int n, int a[][SIZE], int b[][SIZE])
{
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
if (a[i][j] == b[i][j]) // if the pixel is same return false
return false;
return true;
}
int main()
{
int m, n;
cout << "\nEnter the dimensions: ";
cin >> m >> n;
int a[SIZE][SIZE], b[SIZE][SIZE];
cout << "\nEnter array A:\n"; // Input array A
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
cin >> a[i][j];
cout << "\nEnter array B:\n"; // Input array B
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
cin >> b[i][j];
if (check(m, n, a, b)) // check function called
cout << "\nTrue\n";
else
cout << "\nFalse\n";
return 0;
}
Please comment in
case of doubts or queries.
It would be really helpful if you upvote :)