Răspuns:
#include <iostream>
#include<fstream>
using namespace std;
ifstream f("bac.txt");
int x,fr[1000000],ok = 0;
int main() {
while (f >> x) {
if (x % 2 == 0 && fr[x] < 1) {
ok = 1;
++fr[x];
cout << x << " ";
}
}
if (ok == 0)
cout << "Nu exista";
return 0;
}
Explicație: