/* Program which searches a file of numbers for a number. Exits with status 0 if found, 1 otherwise. */ #include #include #include #include int main(int argc, char * argv[]) { typedef long long number; typedef std::istream_iterator iter; number v; std::stringstream s; s << argv[1]; s >> v; std::ifstream in(argv[2]); iter b(in); iter e; return std::find(b, e, v) != e ? 0 : 1; }