c++ - Redefine EOF as character string -


I am trying to write a program that receives the sequence of words, puts them in a vector and its Afterwards does anything. I have worked in a way that is:

  {vector < String & gt; Inputs; String input; Cin & gt; & Gt; Input; While (input! = "Skip") {inputs.push_back (input); Cin & gt; & Gt; Input; }}   

However, I am trying to use any other method to do this, which is:

  {istream_iterator & lt; String & gt; Ii (cin); Istream_iterator & lt; String & gt; EOS; Of vector & lt; String & gt; Inputs (ii, EOS); }   

But I do not know how to skip mean EOF, which will end the input stream and put the words into vector. What can I do string "quit" as a string terminator?

eof to -1 > Cstdio . You can try the #undef EOF and #define EOF "Quit" , but it will probably break the implementation that is signed on EOF The integer done and / or -1 . So basically, leave it alone.

Comments