Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
797 B
1
Indexable
Never
#include <iostream>
using namespace std;
#define SIZE 8
int equal(int arr1[], int arr2[], int size);

int main()
{
	int array1[SIZE] = { 0 };
	int array2[SIZE]={0};
	int size1 = 8;
	int result = 0;

	cout << "Enter your number for arr1" << endl;
	for (int i = 0; i < size1; ++i)
	{
		cin >> array1[i];
	}
	cout << "Enter your number for arr2" << endl;
	for (int j = 0; j < size1; ++j)
	{
		cin >> array2[j];
	}

	
	result=equal(array1, array2, size1);
	cout << result << endl;

	return 0;
}


int equal(int arr1[], int arr2[], int size)
{
	int i = 0, j = 0;
	int counter = 0;
	for (int i = 0; i < size; ++i)
	{
		for (int j = 0; j < size; ++j)
		{
			if (arr1[i] == arr2[j])
			{
				counter++;
			}
			else
				continue;

		}
	}
	return counter;
}