Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Write a C++ program that will do the following: Ask the user to enter the option to pick between infix, prefix, or postfix.Allow the user to enter a mathematical expression per the option above.Allow...

1 answer below »
Write a C++ program that will do the following:
Ask the user to enter the option to pick between infix, prefix, or postfix.Allow the user to enter a mathematical expression per the option above.Allow the user to enter the option to pick between infix, prefix, or postfix.Ensure that the user does not pick the same exact option again.Validate that the expression entered is correct per the option picked in step 1.Evaluate the expression entered per the option selected in step 1.Display the value produced in the above step.Convert the expression to be represented per the option picked in step 3.Display the new expression after being converted in the above step.Evaluate the expression after being converted.Display the value produced in the above step.
Answered Same Day Oct 11, 2021

Solution

Swapnil answered on Oct 11 2021
125 Votes
#include #include #include #include
void getEq(std::stack & eq);
void getCnv(std::stack eq, int c);
void getEval(int c, std::stack & eq, int c2);
void getValConv(int n1, int n2, int c2, std::str opr);
using namespace std;
int main()
{
stack eq;
getEq(eq);
return 0;
}
void getEq(stack & eq)
{
str n1, n2, opr;
int c;
cout
"1. Infix. "
endl;
cout
"2. Prefix. "
endl;
cout
"3. Postfix. "
endl;
cin
c;
switch(c)
{
     case 1:
     {
     cout
"Enter first number"
endl;
     cin
n1;
     cout
"Enter the operation."
endl;
     cin
opr;
     cout
"Enter the second number."
endl;
     cin
n2;
     eq.push(n1);
     eq.push(opr);
     eq.push(n2);
     }
    
eak;
     case 2:
     {
     cout
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here