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 Postfix format:\t"; cin>>postfix_expression; cout<<"\nExpression in Postfix Format: \t"<= '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<<"Invalid"; } push(temp); } } value = pop(); return value; } void push(long int character) { if(top > 50) { cout<<"Stack Overflow\n"; exit(1); } top = top + 1; stack[top] = character; } int pop() { if(isEmpty()) { cout<<"Stack is Empty\n"; exit(1); } return(stack[top--]); } int isEmpty() { if(top == -1) { return 1; } else { return 0; } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

What is the errors here? correct it please

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


#include<iostream>
#include<cmath>
#include<stdlib.h>
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 Postfix
format:\t";
cin>>postfix_expression;
cout<<"\nExpression in Postfix Format:
\t"<<postfix_expression<<endl;
evaluated_value = postfix_evaluation();
cout<<"\nEvaluation of Postfix Expression:
\t" <<evaluated_value<<endl;
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<<"Invalid";
}
push(temp);
}
}
value = pop();
return value;
}
void push(long int character)
{
if(top > 50)
{
cout<<"Stack Overflow\n";
exit(1);
}
top = top + 1;
stack[top] = character;
}
int pop()
{
if(isEmpty())
{
cout<<"Stack is Empty\n";
exit(1);
}
return(stack[top--]);
}
int isEmpty()
{
if(top == -1)
{
return 1;
}
else
{
return 0;
}
}

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY