Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <fstream>
- #include <list>
- #include <iterator>
- int main()
- {
- std::fstream ifs("INPUT.txt", std::ios::in), ofs("OUTPUT.txt", std::ios::out);
- std::list<int> l((std::istream_iterator<int>(ifs)), std::istream_iterator<int>());
- int eSearch;
- std::cout << "Input an element to search for: ";
- std::cin >> eSearch;
- auto it = l.begin(), itEnd = l.end();
- while(it != itEnd)
- {
- if(eSearch == *it++)
- {
- ofs << "ЕСТЬ";
- goto costyl;
- }
- }
- ofs << "НЕТ";
- costyl:
- ifs.close();
- ofs.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement