0
#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;
}

and what is below error about?
error C2146: syntax error : missing ';' before identifier 'create'
fatal error C1004: unexpected end of file found
Error executing cl.exe.

Cpp1.obj - 2 error(s), 0 warning(s)

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by des6043
0

Thats not the c++ code you are trying to run.
Its little language constructs plus a lot of algorithmic language. Hence, the syntax errors
Please read a beginner's book on c++

Cheers

0

robert:i wan to convert infix expression to postfix expression...
abhi:ok...thanks...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.