title: Accepting user input in a while loop
body: <p>I'm trying to create a simple temperature conversion program that allows the user to convert temperatures as many times as they want until they decide to end the program by entering the letter 'e'. Everything else in the code works except the part where the user enters the letter 'e'. If I take the last else statement out, the program just starts at the beginning of the loop again. If I leave the else statement in, when the user enters the letter 'e', the else statement thinks that it is invalid input and does not end the program.  </p>
  
  <pre><code> #include &lt;iostream&gt;
  
  using namespace std;
  
  float celsiusConversion(float cel){     // Calculate celsius conversion
      float f;
  
      f = cel * 9/5 + 32;
      return f;
  }
  
  float fahrenheitConversion(float fah){  // Calculate fahrenheit conversion
      float c;
  
      c = (fah - 32) * 5/9;
      return c;
  
  }
  int main()
  {
      char userInput;
  
          while (userInput != 'e' or userInput != 'E')    // Loop until user enters the letter e
          {
  
              cout &lt;&lt; "Please press c to convert from Celsius or f to convert from Fahrenheit. Press e to end program." &lt;&lt; endl;
              cin &gt;&gt; userInput;
  
  
              if (userInput == 'c' or userInput == 'C') // Preform celsius calculation based on user input 
                  {
                      float cel;
                      cout &lt;&lt; "Please enter the Celsius temperature" &lt;&lt; endl;
                      cin &gt;&gt; cel;
                      cout &lt;&lt; cel &lt;&lt; " Celsius is " &lt;&lt; celsiusConversion(cel) &lt;&lt;  " fahrenheit" &lt;&lt; endl;
                  }
              else if (userInput == 'f' or userInput == 'F')  // Preform fahrenheit calculation based on user input
                  {
                      float fah;
                      cout &lt;&lt; "Please enter the Fahrenheit temperature" &lt;&lt; endl;
                      cin &gt;&gt; fah;
                      cout &lt;&lt; fah &lt;&lt; " Fahrenheit is " &lt;&lt; fahrenheitConversion(fah) &lt;&lt; " celsius" &lt;&lt; endl;
                  }
              else    // If user input is neither c or f or e, end program
                  {
                      cout &lt;&lt; "Invalid entry. Please press c to convert from Celsius, f to convert from Fahrenheit, or e to end program." &lt;&lt; endl;
                  }
          }
      return 0;
  }
  </code></pre>