#include <iostream.h>
#include <conio.h>

int main()


create s;
push (s, '#');

while (not end of infix input)
{
	ch = get char;
	
	if (ch is an operand)
		add ch to postfix expression;
	if (ch is a '(')
		push (s, ch);
	if (ch is a ')')
	{
		pop (s);
		while (ch !='('))
		{
			add ch to postfix expression;
			pop (s);
		}
	}

	if (ch is an operator)
	{
		while (!isEmpty(s)&&(precedence(stackTop())>=precedence(ch)))
		{
			pop (s);
			add ch to postfix expression;
		}
		push (s, ch);
	}
}

while (stackTop() !='#')
{
	pop (s);
	add ch to postfix expression;

getch();
return 0;
}

What is the problem of the code in converting infix expression to postfix expression?
And also how to apply (2+5)*3 to it?

The "problem" is that it is still pseudo-code.

> if (ch is an operand)
This needs to be turned into real code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.