Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. ifstream f("bac.txt");
  5. int ok,s,a,j,k;
  6. main()
  7. {
  8.     ok=0;
  9.     s=0;
  10.     while(f>>a)
  11.     {
  12.         if(a%2!=0)
  13.             s=s+1;
  14.         if(s==1)
  15.         {
  16.             f>>j>>k;
  17.             if(a%2==0 && j%2==0 && k%2!=0)
  18.             {
  19.                 cout<<a<<" "<<j;
  20.                 ok=1;
  21.             }
  22.             else
  23.             {
  24.                 a=j;
  25.                 j=k;
  26.                 f>>k;
  27.             }
  28.         }
  29.     }
  30.     if(ok==0)
  31.         cout<<"nu exista";
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement