title: Program to evaluate postfix expressions but there is a wierd problem with this program-it does not gives output and instead gives a long error
body: <p>I was writing a code for postfix expression evaluation and encountered a weird error. it shows a big error which is really difficult for me to understand what is wrong in the code.
  it would be really helpful if you please have a look and tell me what's wrong with it or what mistake I have made.
  I have listed the code below to have a look.<br />
  <strong>thank you in advance</strong></p>
  <p>here is the code :</p>
  <pre class="lang-cpp prettyprint-override"><code>#include&lt;iostream&gt;
  #include&lt;stack&gt;
  #include&lt;string&gt;
  
  using namespace std;
  
  int evaluate(string expression);
  
  bool Isdigit(char c);
  
  bool IsOprator(char c);
  
  int performcalc(char opration,int op2,int op1);
  
  int main(){
      string expression;
      cout&lt;&lt;&quot;Start of the program ! &quot;&lt;&lt;endl;
      cout&lt;&lt;&quot;Enter a postfix expression to evaluate: &quot;;
      cin&gt;&gt;expression;
      int result = evaluate(expression);
      cout&lt;&lt;&quot;Result =&quot;&lt;&lt;result&lt;&lt;endl;
      cout&lt;&lt;&quot;End of the program !!&quot;;
      return 0;
  }
  
  int evaluate(string expression){
      stack &lt;char&gt; S;
      
      for (int i = 0; i &lt; expression.length(); i++)
      {
          if (expression[i] == ' ' || expression[i] == ',')
          {
              continue;
          }
          else if (Isdigit(expression[i]))
          {
              int a = stoi(expression[i]);
              S.push(a);
          }
          
          else if (IsOprator(expression[i]))
          {
              int op2 = S.top(); S.pop();
              int op1 = S.top(); S.pop();
              int result = performcalc(expression[i],op2,op1);
              S.push(result);
          }
      }
      return S.top();
  }
  
  bool Isdigit(char c){
      if (c &gt;= '0' &amp;&amp; c&lt;='9')
      {
          return true;
      }
      else
      {
          return false;
      }
      
  }
  
  bool IsOprator(char c){
      if (c == '+' || c == '*' || c == '/' || c == '-' )
      {
          return true;
      }
      else
      {
          return false;
      }
      
  }
  
  int performcalc(char opration,int op2,int op1){
      if (opration == '+')
      {
          return op1+op2;
      }
      else if (opration == '-')
      {
          return op1-op2;
      }
      else if (opration == '*')
      {
          return op1*op2;
      }
      else if (opration == '/')
      {
          return op1/op2;
      }
      return -1;
  }
  </code></pre>
  <p><em><strong>Error :</strong></em></p>
  <pre><code>Postfix_evaluation_using_stack.cpp: In function 'int evaluate(std::string)':
  Postfix_evaluation_using_stack.cpp:37:39: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits&lt;std::allocator&lt;char&gt;, ch
  ar&gt;::value_type&amp;)'
     37 |             int a = stoi(expression[i]);
        |                                       ^
  In file included from c:\ming\mingw\include\c++\9.2.0\string:55,
                   from c:\ming\mingw\include\c++\9.2.0\bits\locale_classes.h:40,
                   from c:\ming\mingw\include\c++\9.2.0\bits\ios_base.h:41,
                   from c:\ming\mingw\include\c++\9.2.0\ios:42,
                   from c:\ming\mingw\include\c++\9.2.0\ostream:38,
                   from c:\ming\mingw\include\c++\9.2.0\iostream:39,
                   from Postfix_evaluation_using_stack.cpp:1:
  c:\ming\mingw\include\c++\9.2.0\bits\basic_string.h:6503:3: note: candidate: 'int std::__cxx11::stoi(const string&amp;, std::size_t*, int)'
   6503 |   stoi(const string&amp; __str, size_t* __idx = 0, int __base = 10)
        |   ^~~~
  c:\ming\mingw\include\c++\9.2.0\bits\basic_string.h:6503:22: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits&lt;st
  d::allocator&lt;char&gt;, char&gt;::value_type' {aka 'char'} to 'const string&amp;' {aka 'const std::__cxx11::basic_string&lt;char&gt;&amp;'}
   6503 |   stoi(const string&amp; __str, size_t* __idx = 0, int __base = 10)
        |        ~~~~~~~~~~~~~~^~~~~
  c:\ming\mingw\include\c++\9.2.0\bits\basic_string.h:6609:3: note: candidate: 'int std::__cxx11::stoi(const wstring&amp;, std::size_t*, int)'
   6609 |   stoi(const wstring&amp; __str, size_t* __idx = 0, int __base = 10)
        |   ^~~~
  c:\ming\mingw\include\c++\9.2.0\bits\basic_string.h:6609:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits&lt;st
  d::allocator&lt;char&gt;, char&gt;::value_type' {aka 'char'} to 'const wstring&amp;' {aka 'const std::__cxx11::basic_string&lt;wchar_t&gt;&amp;'}
   6609 |   stoi(const wstring&amp; __str, size_t* __idx = 0, int __base = 10)
  </code></pre>