title: How to get cin multiple times in different lines?
body: <p>I want to get input twice with one variable a string and the other character, but it always comes out compilation error, how do I solve this problem. I've tried cin.clear(); but it seems not working in this case.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using std::cout;
  using std::cin;
  using std::endl;
  
  #include &lt;string&gt;
  using std::string;
  using std::getline;
  
  int main(){
      string name;
      cout &lt;&lt; "Please input a string." &lt;&lt; endl;
      getline (cin, name);
      cout &lt;&lt; "Hello, there, "&lt;&lt; name  &lt;&lt;".\n";
      char ccc;
      cout &lt;&lt; "Please input a character." &lt;&lt; endl;
      getline (cin, ccc);
      cout &lt;&lt; "This is a alphabet:" &lt;&lt; ccc &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>I expect the output will be like:</p>
  
  <pre><code>Please input a string.
  John
  Hello, there, John.
  Please input a character.
  c
  This is a alphabet:c
  </code></pre>