Please help in C++
each input transaction will comprise an mathematics expression in post-fix layout. expect that each operand is a single man or woman in each arithmetic expression. you could expect that each arithmetic expression is correctly formatted. but, your program ought to not permit an try to divide by zero. rather than dividing via 0, your application need to show an errors message and then start comparing a new line of code
An enter transaction containing “end-of-file” shows there are not any extra transactions to be processed. implement a stack to assess every expression and show the result. Use the C++ built-in elegance to put in force stack functions.
sample
To solve a postfix expression
1)make a stack
2)start traversing the expression if the character is an operand pop two elements from stack and push their result in stack
3)else push the number in stack
4)at last pop the element from stack this is the result
#include <bits/stdc++.h>
using namespace std;
int main() {
cout<<"Enter the file name"<<endl;
string fileName;
cin>>fileName;
ifstream file(fileName);
while(!file.eof())
{
string expression;
getline(file,expression);
bool result=false;
stack<int> s;
for(int
i=0;i<expression.length();i++)
{
if(expression[i]=='+')
{
int a=s.top();
s.pop();
int b=s.top();
s.pop();
s.push(a+b);
}
else
if(expression[i]=='-')
{
int a=s.top();
s.pop();
int b=s.top();
s.pop();
s.push(b-a);
}
else
if(expression[i]=='*')
{
int a=s.top();
s.pop();
int b=s.top();
s.pop();
s.push(b*a);
}
else
if(expression[i]=='/')
{
int a=s.top();
s.pop();
int b=s.top();
s.pop();
if(a==0)
{
result=true;
cout<<"result=error:
division by zero"<<endl;
break;
}
else
s.push(b/a);
}
else
s.push(expression[i]-'0');
}
if(result==false)
{
int x;
if(s.empty()==false)
{
x=s.top();
s.pop();
cout<<"result="<<x<<endl;
}
}
}
file.close();
return 0;
}


Please help in C++ each input transaction will comprise an mathematics expression in post-fix layout. expect that...