title: RPN calculator / post fix calculator
body: <p>So, i have to make a postfix calculator or a RPN calculator, the question goes like </p>
  
  <p>The task is to write a simplified calculator that works only on integers. Your code has to provide a function called evaluate, which takes one argument: a std::string and returns an integer. The calculator has to work in the following way:</p>
  
  <ol>
  <li>it reads a string character by character,</li>
  <li>if it reads a digit it puts it on its own internal stack,</li>
  <li>if it reads a space it has to ignore it,</li>
  <li>if it reads a character +,-, * or / it performs the operation on two topmost elements of the stack, deletes them and puts the result on the stack,</li>
  <li>when it reaches the end of the std::string argument it returns the top of the stack.</li>
  </ol>
  
  <p>Code: </p>
  
  <pre><code>using namespace std;
  
  int evaluate(string);
  bool isdigit(char c);
  bool isOp(char c);
  
  bool isdigit(char c)
  {
      if (c &gt;= '0' &amp;&amp; c &lt;= '9')
      {
          return true;
      }
      return false;
  }
  
  int main()
  {
  
      string str;
      cout &lt;&lt; "\n Enter the input : ";
      cin &gt;&gt; str;
  
      evaluate(str);
  }
  
  int evaluate(string str)
  {
      stack&lt;int&gt; mystack;
      stack&lt;int&gt; vals;
  
      for (int i = 0; i &lt; str.size(); i++)
      {
          char c = str[i];
          if (isdigit(c))
          {
              vals.push(c);
          }
          else if (c == ' ')
          {
              c = ' ';
              cout &lt;&lt; str;
          }
          else
          {
              int value1, value2, result;
  
              value2 = vals.top();
              vals.pop();
  
              value1 = vals.top();
              vals.pop();
  
              switch (str[i])
              {
                  case '+':
                      result = value1 + value2;
                      mystack.push(result);
                      break;
  
                  case '-':
                      result = value1 - value2;
                      mystack.push(result);
                      break;
  
                  case '*':
                      result = value1 * value2;
                      mystack.push(result);
                      break;
  
                  case '/':
                      result = value1 / value2;
                      mystack.push(result);
  
                      break;
              }
  
              cout &lt;&lt; "result is " &lt;&lt; mystack.top();
  
          }
      }
  }
  </code></pre>
  
  <p>i expect the actual answers, but i guess the program is not ignoring 
          the space and when i input the string without spaces theres still a 
          wrong output</p>