title: Allowing multiple types of input for various forms of "yes" and "no" in C++
body: <p>I <a href="https://stackoverflow.com/questions/4062947/">posted a question</a> about how to get user input such as YES or NO to control the flow of a program using if else statements, I got a answer and now i'm a step closer to making this work, however another problem has arisen, i really need to allow for multiple inputs, for example this is what im trying:</p>
  
  <pre><code>if (input == ("YES" || "yes" || "y" || "Yes" || "Y"))
  {
      cout &lt;&lt; "you said yes" &lt;&lt; endl;
  }
  else if (input == "NO", "no", "n", "No","N")
  {
      cout &lt;&lt; "you said no" &lt;&lt; endl;
  }
  else 
  {
      cout &lt;&lt;  "ERROR!!!" &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Kiril Kirov posted this code that could help:</p>
  
  <pre><code>if( std::string::npos != input.find( "no" ) )
  </code></pre>
  
  <p>but i couldn't get it to work, and roger pate suggested this:</p>
  
  <pre><code>if (prompt &amp;&amp; cin.tie()) {
  *cin.tie() &lt;&lt; prompt &lt;&lt; (default_yes ? " [Yn] " : " [yN] ");
  </code></pre>
  
  <p>however i never tried this as its complexity is far beyond my understanding. i was hoping for a solution a beginner programmer could understand or maybe im just a really slow learner</p>
  
  <hr>
  
  <p>EDIT:
  I made this modification but it still doesn't work any better then before, if i give the wrong case it goes to else (error) and there is no where to add more words, (such as NO N no No) :</p>
  
  <pre><code>cout &lt;&lt; "\nYES or NO" &lt;&lt; endl;
  string input ="";
  cin &gt;&gt; input;
  
  if ( std::string::npos != input.find( "yes" ) )
  {
      cout &lt;&lt; "you said yes" &lt;&lt; endl;
  }
  else if ( std::string::npos != input.find( "no" ) )
  {
      cout &lt;&lt; "you said no" &lt;&lt; endl;
  }
  else 
  {
      cout &lt;&lt;  "ERROR!!!" &lt;&lt; endl;
  }
  </code></pre>