title: How to fix a loop on C++
body: <p>I am working on a homework to where it asks the user to type in an abbreviation of states and when it gets the correct input it displays the full name of the state. I have the code below but for some reason even when I type the correct abbreviation, for example TN, I still get an Invalid Entry!. It has to be a simple mistake I am making in the while loop condition or I am missing something but I cannot seem to figure it out.. Help would be appreciated!!</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  
  int main() {
  
     string state;
     string KY, OH, IN, TN, WV;
  
     cout &lt;&lt; "Question 1:" &lt;&lt; endl;
     cout &lt;&lt; "Enter state abbreviation (KY, OH, IN, TN, WV): ";
     cin &gt;&gt; state;
  
     while (state != KY &amp;&amp; state != OH &amp;&amp; state != IN &amp;&amp; state != TN &amp;&amp; state != WV) {
         cout &lt;&lt; "Invalid Entry!";
         cout &lt;&lt; "\nEnter state abbreviation (KY, OH, IN, TN, WV): ";
         cin &gt;&gt; state;
     }
  
     if (state == KY)
         cout &lt;&lt; "Kentucky";
     if (state == OH)
         cout &lt;&lt; "Ohio";
     if (state == IN)
         cout &lt;&lt; "Indiana";
     if (state == TN)
         cout &lt;&lt; "Tennessee";
     if (state == WV)
         cout &lt;&lt; "West Virgnia";
  
     system("Pause");
     return 0;
   }
  </code></pre>