Advertisement
Guest User

1337smokeweed420

a guest
Dec 1st, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <fstream>
  4. #include <list>
  5. #include <iterator>
  6.  
  7. int main()
  8. {
  9. std::fstream ifs("INPUT.txt", std::ios::in), ofs("OUTPUT.txt", std::ios::out);
  10. std::list<int> l((std::istream_iterator<int>(ifs)), std::istream_iterator<int>());
  11. int eSearch;
  12. std::cout << "Input an element to search for: ";
  13. std::cin >> eSearch;
  14. auto it = l.begin(), itEnd = l.end();
  15. while(it != itEnd)
  16. {
  17. if(eSearch == *it++)
  18. {
  19. ofs << "ЕСТЬ";
  20. goto costyl;
  21. }
  22. }
  23. ofs << "НЕТ";
  24. costyl:
  25. ifs.close();
  26. ofs.close();
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement