message: Update infix_to_postfix.cpp
diff: -#include<bits/stdc++.h>
  +#include<iostream>
  +#include<cstdio>
  +#include<cmath>
  +#include<stack>
  using namespace std;
  +int isOperand(char ch) {
  + return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (isdigit(ch));
  +}
  -//function to return precedence of operators
  -int prec(char c) {
  - if(c == '^')
  - return 3;
  - else if(c == '/' || c=='*')
  - return 2;
  - else if(c == '+' || c == '-')
  +int checkPrecedence(char ch) {
  + switch (ch) {
  + case '+':
  + case '-':
  return 1;
  - else
  + case '*':
  + case '/':
  + return 2;
  + case '^':
  + return 3;
  + }
  return -1;
  }
  -//required function
  -void infixToPostfix(string s) {
  -
  +int infixToPostfix(char exp[], char output[]) {
  + int i = 0, k = 0;
  stack < char > st;
  - string result;
  -//According to convention of stack implentation of infix to postfix expression, conditions are checked.
  - for(int i = 0; i < s.length(); i++) {
  - char c = s[i];
  - if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))
  - result += c;
  - else if(c == '(')
  - st.push('(');
  - else if(c == ')') {
  - while(st.top() != '(')
  - {
  - result += st.top();
  + while (exp[i]) {
  + if (isOperand(exp[i]))
  + output[k++] = exp[i];
  + else if (exp[i] == '(')
  + st.push(exp[i]);
  + else if (exp[i] == ')') {
  + while (!st.empty() && st.top() != '(') {
  + output[k++] = st.top();
  st.pop();
  }
  + if (!st.empty() && st.top() != '(')
  + return -1;
  + else
  st.pop();
  - }
  - else {
  - while(!st.empty() && prec(s[i]) <= prec(st.top())) {
  - result += st.top();
  + } else {
  + while (!st.empty() && checkPrecedence(exp[i]) <= checkPrecedence(st.top())) {
  + output[k++] = st.top();
  st.pop();
  }
  - st.push(c);
  + st.push(exp[i]);
  }
  + i++;
  }
  while (!st.empty()) {
  - result += st.top();
  + output[k++] = st.top();
  st.pop();
  }
  -//Printing the result
  - cout << result << endl;
  +
  + output[k++] = '\0';
  }
  int main() {
  - string exp;
  - cin>>exp;
  - infixToPostfix(exp);
  + char exp[] = "6/(3^2)-8";
  + char output[20];
  + infixToPostfix(exp, output);
  + cout << "Given infix expression is : " << exp << endl;
  + cout << "Equivalent postfix expression is : " << output << endl;
  return 0;
  }
  