Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- void afisare()
- {
- ifstream fin("bac.txt");
- int count = 0;
- int max1 = -1,max2=-1;
- int a;
- while (fin>>a && count!=4)
- {
- if (a% 2 != 0)
- count++;
- if (count == 3 && a % 2 == 0)
- {
- if (a > max1)
- {
- if (max1 > max2)
- max2 = max1;
- max1 = a;
- }
- else
- if(a>max2)
- max2 = a;
- }
- }
- if (max1 == -1 || max2 == -1)
- cout << "nu exista";
- else
- {
- if (max1 < max2)
- cout << max1 << " " << max2;
- else
- cout << max2 << " " << max1;
- }
- }
- int main()
- {
- afisare();
- cout << endl << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement