What is the errors here? correct it please //Evaluate the postfix expression // XXXXXXXXXX/+*2&3+ #include #include #include using namespace std; void push(long int character); long int...



What is the errors here? correct it please


//Evaluate the postfix expression
//623+-382/+*2&3+




#include
#include
#include
using namespace std;
void push(long int character);
long int postfix_evaluation();
int pop();
int isEmpty();
int top;
long int stack[50];
char postfix_expression[50];
int main()
{
long int evaluated_value;
top = -1;
cout<"\nenter an="" expression="" in="">
format:\t";
cin>>postfix_expression;
cout<"\nexpression in="" postfix="">
\t"<><>
evaluated_value = postfix_evaluation();
cout<"\nevaluation of="" postfix="">
\t" <><>
system("pause");
return 0;
}
long int postfix_evaluation()
{
double x, y, temp, value;
int count;
for(count = 0; count
strlen(postfix_expression); count++)
{
if(postfix_expression[count] <= '9'="">
postfix_expression[count] >= '0')
{
push(postfix_expression[count] - '0');
}
else
{
x = pop();
y = pop();
switch(postfix_expression[count])
{
case '+': temp = y + x;
break;
case '-': temp = y - x;


break;
case '*': temp = y * x;
break;
case '/': temp = y / x;
break;
case '&': temp = pow(y, x);
break;
case '^': temp = pow(y, x);
break;
default: cout<>
}
push(temp);
}
}
value = pop();
return value;
}
void push(long int character)
{
if(top > 50)
{
cout<"stack>
exit(1);
}
top = top + 1;
stack[top] = character;
}
int pop()
{
if(isEmpty())
{
cout<"stack is="">
exit(1);
}
return(stack[top--]);
}
int isEmpty()
{
if(top == -1)
{
return 1;
}
else
{
return 0;
}
}

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here