Advertisement
Guest User

Untitled

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