# Untitled

unknown
plain_text
a year ago
1.9 kB
1
Indexable
Never
```#include <iostream>
using namespace std;

const int MAX_SIZE = 100;  // Maximum size of matrices

// Function to perform Boolean join operation on matrices
void booleanJoin(int matrix1[][MAX_SIZE], int matrix2[][MAX_SIZE], int result[][MAX_SIZE], int rows, int cols) {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
result[i][j] = matrix1[i][j] && matrix2[i][j];
}
}
}

// Function to display a matrix
void displayMatrix(int matrix[][MAX_SIZE], int rows, int cols) {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
cout << matrix[i][j] << " ";
}
cout << endl;
}
}

int main() {
int matrix1[MAX_SIZE][MAX_SIZE];
int matrix2[MAX_SIZE][MAX_SIZE];
int result[MAX_SIZE][MAX_SIZE];
int rows, cols;

// Input matrix 1
cout << "Enter the number of rows for matrix 1: ";
cin >> rows;
cout << "Enter the number of columns for matrix 1: ";
cin >> cols;
cout << "Enter the elements of matrix 1 (0 or 1):" << endl;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
cin >> matrix1[i][j];
}
}

// Input matrix 2
cout << "Enter the number of rows for matrix 2: ";
cin >> rows;
cout << "Enter the number of columns for matrix 2: ";
cin >> cols;
cout << "Enter the elements of matrix 2 (0 or 1):" << endl;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
cin >> matrix2[i][j];
}
}

// Perform Boolean join operation
booleanJoin(matrix1, matrix2, result, rows, cols);

// Display the result
cout << "Boolean Join of matrix 1 and matrix 2:" << endl;
displayMatrix(result, rows, cols);

return 0;
}
```