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 DayOct 11, 2021

Answer To: Write a C++ program that will do the following: Ask the user to enter the option to pick between...

Swapnil answered on Oct 11 2021
123 Votes
#include
#include
#include
#include
void getEq(std::stackd::str> & 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);
     }
     break;
     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