title: 'string'/'cin' was not declared in this scope
body: <p>I'm working on an assignment where I have to split up a program into modules of .cpp and .h files, and I'm getting a weird error. In one of my .cpp files, I have the code</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  
  
  bool getYesNoResponse()
  {
      string response;
      getline (cin, response);
      while (response.size() == 0 ||
      (response[0] != 'y' &amp;&amp; response[0] != 'Y'
       &amp;&amp; response[0] != 'n' &amp;&amp; response[0] != 'N'))
      {
          if (response.size() &gt; 0)
          cout &lt;&lt; "Please respond 'yes' or 'no'. " &lt;&lt; flush;
          getline (cin, response);
      }
      return response[0] == 'y' || response[0] == 'Y';
  }
  </code></pre>
  
  <p>I get the error <code>error: 'string' was not declared in this scope</code>. I'm not supposed to edit the actual code given to me (we're only supposed to write the includes and defining the functions in the .h files), but I wanted to see if the string problem was a one time thing, so I replaced <code>string</code> with <code>std::string</code> in the "<code>string response;</code>" line, and the problem ceased; except I then got <code>error: 'cin' was not declared in this scope</code> with the next line. I have my <code>#include</code> for <code>&lt;string&gt;</code>, <code>&lt;iostream&gt;</code>, and <code>&lt;fstream&gt;</code>, so I'm rather confused as to why it's not working. Any advice on how to fix this without altering my source code would be appreciated!</p>