Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- fstream in("bac.txt");
- int V[50], i=1, n=0, k=0, p, comp[50];
- int m = 0, j = 0;
- bool stop=false;
- int main()
- {
- while (!in.eof())
- {
- in >> V[i];
- i++;
- n++;
- }
- for (i = 1; i <= n; i++)
- {
- if (V[i] % 2 != 0 && k < 3)
- {
- k++;
- }
- if (k==3 && stop == false)
- {
- stop = true;
- p = i;
- }
- }
- p++;
- for (i = p; i <= n; i++)
- {
- if (V[i] % 2 == 0)
- {
- m++;
- j++;
- comp[j] = V[i];
- }
- if(V[i]%2!=0)
- i = 100;
- }
- if (comp[1] != NULL)
- {
- for (j = 1; j <= m; j++)
- {
- if (comp[j] > comp[j + 1])
- cout << comp[j] << " ";
- }
- }
- else
- cout << "NU";
- cout << "\n";
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement