괄호 있는 수식을 입력 받아서 후위 표기로 바꾸는 건데요
입력을 어떻게 받는지를 모르겠네요~~ ㅜㅜ 글고 에러도 넘 많아요 고쳐주세요 ㅜ0ㅠ
#include <iostream.h>
using std::cin;
using std::cout;
using std::endl;
void postfix(expression e)
{
Stack<token>stack;
token y;
stack.Add('#');
for(token x == NextToken(e)x != '#';x=NextToken(e))
{
if(x is an operand)cout<<x;
else if(x==')')
for(y=*stack.Delete(y);y !='(';y=*stack.Delete(y));cout<<y;
else {
for(y=*stack.Delete(y);isp(y)<=icp(x);y=*stack.Delete(y));cout<<y;
stack.Add(y);
stackAdd(x);
}
}
while(!stack.IsEmpty())cout<<*stack.Delete(y);
}
대충 이렇게 했는데요 ㅜ0ㅜ
에러가 넘 많아요
|