27 lines
559 B
C++
27 lines
559 B
C++
#include <bits/stdc++.h>
|
|
#include <iostream>
|
|
using namespace std;
|
|
|
|
|
|
// harmadik feladat
|
|
vector<int> common(vector<int> a, vector<int> b) {
|
|
vector<int> out;
|
|
for (int i = 0; i < a.size(); i++) {
|
|
for (int j = 0; j < b.size(); j++) {
|
|
if (a[i] == b[j]) {
|
|
out.push_back(a[i]);
|
|
}
|
|
}
|
|
}
|
|
return out;
|
|
}
|
|
|
|
int main() {
|
|
vector<int> a = {1,2,3,4,5,6};
|
|
vector<int> b = {2,4,6,8,10};
|
|
vector<int> out = common(a,b);
|
|
|
|
for (int i = 0; i < out.size(); i++) {
|
|
cout<<out[i]<<" ";
|
|
}
|
|
} |