Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. ifstream fin("bac.txt");
  6.  
  7. int main()
  8. {
  9. int a[81] = {}, x, n = 0, poz;
  10. bool gasit = 0;
  11. while (fin >> x)
  12. {
  13. a[++n] = x;
  14. }
  15. for (int i = 1; i <= n - 2; ++i)
  16. {
  17. if (a[i] < a[i + 2] && !gasit) {gasit = 1, poz = i + 2; break;}
  18. cout << a[i] << ' ';
  19. }
  20. if (gasit) for (int i = poz; i <= n; ++i) cout << a[i] << ' ';
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement