xotohop

файлы_2

May 8th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int cnt = 0;
  6.     int x, y, z;
  7.     ifstream in("input.txt");
  8.     ofstream out("output.txt");
  9.     while (in.peek() != EOF)
  10.     {
  11.         int t;
  12.         in >> t;
  13.         cnt++;
  14.         if (cnt == 1)
  15.             x = t;
  16.         if (cnt == 2)
  17.             y = t;
  18.         if (cnt == 3)
  19.         {
  20.             z = t;
  21.             cnt = 0;
  22.             if (x % 2 == y % 2 && x % 2== z % 2)
  23.                 out << x << " " << y << " " << z << endl;
  24.         }
  25.     }
  26.     in.close();
  27.     out.close();
  28. }
Add Comment
Please, Sign In to add comment