void String::scanFrom(istream& strm) // Read next line of input from strm into this String. { ostream* os = strm.tie((ostream*)0); if (os != 0) { os->flush(); strm.tie(os); } char c; strm.get(c); if (c != '\n') strm.putback(c); char temp[513]; strm.get(temp,513); *this = String(temp); }
short _Ipfx(istream& Is_, int noskip) { if (Is_.good()) { if (Is_.tie() != 0) Is_.tie()->flush(); if (!noskip && Is_.flags() & ios::skipws) { int ch; while (isspace(ch = Is_.rdbuf()->sbumpc())) ; if (ch != EOF) Is_.rdbuf()->sputbackc(ch); } if (Is_.good()) return 1; } Is_.clear(ios::failbit); return 0; }
vector<int> ReadInput(istream &in) { // prepare stream std::ios_base::sync_with_stdio(false); in.tie(nullptr); int numberCount; in >> numberCount; vector<int> sequence(numberCount); for (int i = 0; i < numberCount; ++i) { in >> sequence[i]; } return sequence; }