Website Summary Files Commits Branches @commit @diff @stats
path: root / Week07 / Exercise10.cpp
blob: f31d4b795aff064d1300b08817854e9e77761149 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>

unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* arr2, unsigned int size2) {
	unsigned int count = 0;
	unsigned int size = size1 < size2 ? size1 : size2;

	for (unsigned int i = 0; i < size; i++)
		if (arr1[i] == arr2[i])
			count++;

	return count;
}

int main() {
	const unsigned int SIZE1 = 10, SIZE2 = 15;
	int series1[SIZE1], series2[SIZE2];

	for (unsigned int i = 0; i < SIZE1; i++)
		std::cin >> series1[i];
	for (unsigned int i = 0; i < SIZE2; i++)
		std::cin >> series2[i];

	std::cout << countSameElementsOnSameIndecies(series1, SIZE1, series2, SIZE2) << std::endl;

	return 0;
}