-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion_32.cpp
66 lines (49 loc) · 1.04 KB
/
question_32.cpp
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// FIND THE INTERSECTION BETWEEN TWO ARRAY.
#include<iostream>
using namespace std;
int intersectionArray(int arr[], int brr[], int n, int m)
{
cout<< endl << "The intersection between these two array is : " << endl;
int flag = 0;
for(int i = 0; i < n; i++)
{
if(arr[i] == brr[i])
{
cout << arr[i] << " ";
}
}
return -1;
}
int main()
{
cout << "First array is : " << endl;
int n;
cout <<"Enter size of an array : " << " ";
cin >> n;
int arr[100];
for(int i = 0; i < n; i++)
{
cin >> arr[i];
}
cout << endl;
for(int i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
cout << endl;
cout << "Second array is : " << endl;
int m;
cout <<"Enter size of second array : " << " ";
cin >> m;
int brr[100];
for(int j = 0; j < m; j++)
{
cin >> brr[j];
}
cout << endl;
for(int j = 0; j < m; j++)
{
cout << brr[j] << " ";
}
intersectionArray(arr, brr, n , m);
}