title: a code for infix to postfix conversion
body: <p>I have written a code for infix to postfix conversion,This piece of code is not encountering any kind of compile time error but after taking the input infix expression it is giving some runtime errors which i am unable to understand these errors are something related to string as the message says. </p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string&gt;
  
  #define N 50
  using namespace std;
  
  class stack
  {
  private:
      char arr[N];
      int tos;
  
  public:
      void push(char p)
      {
          if (tos != N)
              arr[++tos] = p;
          else
              cout &lt;&lt; "stack full";
      }
  
      char pop()
      {
          if (tos == -1)
              cout &lt;&lt; "stack Empty";
          else
              return (arr[tos--]);
      }
  
      bool isempty()
      {
          if (tos == -1)
              return (true);
          else 
              return (false);
      }
  
      char top()
      {
          return arr[tos];
      }
  
      stack()
      {
          tos = -1;
      }
  };
  
  int pres(char sym)
  {
      if (sym == '^')
          return 3;
      else if (sym == '*' || '/')
          return 2;
      else if (sym == '+' || '-')
          return 1;
      else if (sym == '(')
          return 0;
  } 
  
  bool isoperator(char op)
  {
      if (op=='+' || op=='-' || op=='/' || op=='*' || op=='^')
          return true;
      else
          return false;
  }
  
  int main()
  {
      string infix, postfix;
      stack s;
      int in=0;
      int post=0;
  
      cout &lt;&lt; "Enter an infix expression: ";
      cin &gt;&gt; infix;
      s.push('(');
      infix.append(")");
      char temp;
  
      while (!(s.isempty()))
      {
          if (isdigit(infix[in]))
              postfix[post++] = infix[in];
          else if (infix[in] == '(')
              s.push(infix[in]);
          else if (infix[in] == ')')
          {
              while (1)
              {
                  temp = s.pop();
                  if (temp == '(')
                      break;
                  else
                      postfix[post] = infix[in];
              }
          }
          else if (isoperator(infix[in]))
          {
              while (pres(s.top()) &gt;= pres(infix[in]))
                  postfix[post++] = s.pop();
  
              s.push(infix[in]);
          }
          in++;
      }
  
      cout &lt;&lt; "Postfix expression is: " &lt;&lt; postfix;
      system("pause");
  
  }
  </code></pre>
  
  <p>I m unable to get what's wrong with it. Can any one help??</p>