title: How to signify no more input for string ss in the loop while (cin >> ss)
body: <p>I used "cin" to read words from input stream, which like</p>
  
  <pre><code>int main( ){
       string word;
       while (cin &gt;&gt; word){
           //do sth on the input word
       }
  
      // perform some other operations
  }
  </code></pre>
  
  <p>The code structure is something like the above one. It is compilable. During the execution, I keep inputting something like</p>
  
  <pre><code>aa bb cc dd
  </code></pre>
  
  <p>My question is how to end this input? In other words, suppose the textfile is just "aa bb cc dd". But I do not know how to let the program know that the file ends.</p>