title: How to only accept "y" or "n" in user's input in C++?
body: <p>The code that I have made is:</p>
  
  <pre><code>while (*user is not closing the program*)
  {
      cout &lt;&lt; "Make a decision? (y/n) " &lt;&lt; endl;
      cin &gt;&gt; userAnswer;
      ...
      if (UsersAnswer != 'y' || UsersAnswer != 'n')
          cout &lt;&lt; "You may only type y or n.";
  }
  </code></pre>
  
  <p>But when I put sentences or words like "hello" it breaks the code (outputs "make a decision?" infinite times)</p>