title: "Transform the expression" where we have to transform the given infix expression to postfix expression
body: <p>All sample cases have passed but when I submit it shows wrong answer though I have programmed the
  logic well.
  Can someone tell me some test cases where my code is giving wrong answer. I think I have programmed my
  logic according to what I have been taught at my school. Please I am very tensed, someone help me.
  Link to question:<a href="https://www.spoj.com/problems/ONP/" rel="nofollow noreferrer">https://www.spoj.com/problems/ONP/</a></p>
  <pre><code>#include&lt;iostream&gt;
  #include&lt;cstring&gt;
  #include&lt;stack&gt;
  using namespace std;
  
  void post_fix(string exp)
  {
      stack&lt;char&gt; s;
      for(int i=0;i&lt;exp.length();i++)
      {
          switch (exp[i])
          {
          case '+':
              while(s.top()=='*'||s.top()=='-'||s.top()=='/'||s.top()=='^')
              {
                  cout&lt;&lt;s.top();
                  s.pop();
              }
              s.push(exp[i]);
              break;
          
          case '-':
              while(s.top()=='*'||s.top()=='/'||s.top()=='^')
              {
                  cout&lt;&lt;s.top();
                  s.pop();
              }
              s.push(exp[i]);
              break;
  
          case '*':
              while(s.top()=='/'||s.top()=='^')
              {
                  cout&lt;&lt;s.top();
                  s.pop();
              }
              s.push(exp[i]);
              break;
  
          case '/':
              while(s.top()=='^')
              {
                  cout&lt;&lt;s.top();
                  s.pop();
              }
              s.push(exp[i]);
              break;
  
          case '^':
              s.push(exp[i]);
              break;
  
          case '(':
              s.push('(');
              break;
  
          case ')':
              while(s.top()!='(')
              {
                  cout&lt;&lt;s.top();
                  s.pop();
              }
              s.pop();
              break;
  
          default:
              cout&lt;&lt;exp[i];
              break;
          }
      }
      while(!s.empty())
      {
          cout&lt;&lt;s.top();
          s.pop();
      }
  }
  
  int main()
  {
      int t;
      cin&gt;&gt;t;
      while(t--)
      {
          string exp;
          cin&gt;&gt;exp;
          post_fix(exp);
      }
      return 0;
  }
  </code></pre>