Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- using namespace std;
- int x,ok,par1=-1,par2=-1;
- int main()
- {
- ifstream in("bac.txt");
- while(in>>x)
- {
- if(ok==0)
- {
- if(x%2==1)
- ok=1;
- }
- else if(ok==1)
- {
- if(x%2==1)
- ok=2;
- else if(x%2==0)
- {
- par2=par1;
- par1=x;
- }
- }
- }
- if(par1==-1 || par2==-1)
- cout<<"Nu exista.";
- else
- cout<<par2<<' '<<par1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement