#include <iostream>
#include <fstream>
#include <random>
using namespace std;
int main()
{
ofstream fout("f.txt");
random_device rd;
mt19937 mer(rd());
for(int i = 0 ; i < 10 ; ++i)
fout << mer() << ' ';
fout.close();
ofstream gout("g.txt");
ifstream fin("f.txt");
for (int i = 0 ; i < 10 ; ++i)
unsigned int temp;
fin >> temp;
if( temp % 2 == 0 )
gout << temp << ' ';
cout << temp << ' ';
}
fin.close();
gout.close();
#include <iostream>
#include <fstream>
#include <random>
using namespace std;
int main()
{
ofstream fout("f.txt");
random_device rd;
mt19937 mer(rd());
for(int i = 0 ; i < 10 ; ++i)
fout << mer() << ' ';
fout.close();
ofstream gout("g.txt");
ifstream fin("f.txt");
for (int i = 0 ; i < 10 ; ++i)
{
unsigned int temp;
fin >> temp;
if( temp % 2 == 0 )
gout << temp << ' ';
cout << temp << ' ';
}
fin.close();
gout.close();
}