title: Using cin.good for strings
body: <p>How do I make cin.good work on strings too?</p>
  
  <p>[this is not a link]</p>
  
  <pre><code>while (1)
      {
          cin.clear();
          cin.sync();
          cout &lt;&lt; "\n" &lt;&lt; "Enter the state you are from" &lt;&lt; endl;
          cin &gt;&gt; s;
          if (!cin.good())
          {
              cout &lt;&lt; "\n" &lt;&lt; "Please the enter the correct form of your state :)" &lt;&lt; endl;
          }
          else
          {
              break;
          }
      }
  </code></pre>
  
  <p>Even if I input a number instead of string, it still does not work.</p>