title: Is there special syntax to follow when comparing chars in C++?
body: <p>I've been learning C++, and I tried to create a basic calculator app. The goal is to obtain two numbers from 0-9 from the user, and a mathematical operation (+, -, *, /); if some other character is typed, I want to loop the program to keep prompting for the proper input.</p>
  
  <p>But whenever I run the program, it doesn't recognize the numbers 0-9, and keeps repeating the loop. These are the main 3 functions I am using. From main, I'm simply calling them, so I doubt the problem is there. Help please?</p>
  
  <p>Oh and I know I'm never supposed to use go-to, but I wanted practice.
  And if you could point out more efficient ways of writing this code, that's awesome.
  Thanks a million.</p>
  
  <pre><code>int GetUserInput(){
  using namespace std;
  cout &lt;&lt; "Please enter a number between 0-9." &lt;&lt; endl;
  
  char inputChar; 
  cin &gt;&gt; inputChar;
  
  while (inputChar != ('1' || '2' || '3' || '4' || '5' || '6' || '7' || '8' || '9' || '0')) {
      cout &lt;&lt; "Please enter a number between 0-9." &lt;&lt; endl;
      cin &gt;&gt; inputChar;
  }
  
  return static_cast &lt;int&gt; (inputChar);
  </code></pre>
  
  <p>}</p>
  
  <pre><code>char GetMathematicalOperation(){
  using namespace std;
  cout &lt;&lt; "Please enter a mathematical operator (+, -, *, /)" &lt;&lt; endl;
  
  // Storing user input character into char inputChar
  char inputChar; 
  
  inputloop:
  cin &gt;&gt; inputChar;
  switch(inputChar) {
      case('+'):
      case('-'):
      case('*'):
      case('/'):
          break;
      default:
          cout &lt;&lt; "Please enter a mathematical operator (+, -, *, /)" &lt;&lt; endl;
          goto inputloop;
      }
  
  return inputChar;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>int CalculateResult(int x, char Operator, int y){
  if (Operator = '+')
      return x+y;
  if (Operator = '-')
      return x-y;
  if (Operator = '*')
      return x*y;
  if (Operator = '/')
      return x/y;
  return 0;
  </code></pre>
  
  <p>}</p>