Code:

#include <iostream>#include <stack>
#include <string>
using namespace std;
void printMenu();
int evaluate(string exp);
int main()
{
char choice;
int result;
string line;
printMenu();
choice = 'Z';
do
{
cout << "What action would you like to perform?\n";
cin.get(choice);
cin.ignore(20, '\n'); //to flush '\n'
choice = toupper(choice);
switch(choice)
{
case 'E':
cout << "Enter an arithmetic expression:" << endl;
getline(cin, line);
result = evaluate(line);
cout << "The evaluated value is: " << result << endl;
break;
case 'Q': //Quit
break;
case '?': //Display Menu
printMenu();
break;
default:
cout << "Unknown action\n";
break;
}
} while (choice != 'Q');
return 0;
}
//Print the menu to a user
void printMenu()
{
cout << "Choice\t\tAction\n";
cout << "------\t\t------\n";
cout << "E\t\tEnter an arithmetic expression to evaluate\n";
cout << "Q\t\tQuit\n";
cout << "?\t\tDisplay Help\n\n";
return;
}
//The evaluate function takes a string containing an arithmetic expression,
//evaluates it,and returns its result
int evaluate(string exp)
{
stack<char> parStack;
stack<int> numStack;
stack<char> opStack;
int j = exp.size();
int i=0;
char x;
while (i<j)
{
if(exp[i] == '(')
{
parStack.push(exp[i]);
cout << exp[i] << endl;
}
if((exp[i]='0') || (exp[i]='1') || (exp[i]='2') || (exp[i]='3') || (exp[i]='4') || (exp[i]='5') || (exp[i]='6') || (exp[i]='7') || (exp[i]='8') || (exp[i]='9'))
{
numStack.push(exp[i]);
}
if((exp[i] = '+') || (exp[i] = '-') || (exp[i] = '*') || (exp[i] = '/') || (exp[i] = '%'))
{
opStack.push(exp[i]);
}
i++;
}

I need to finish "int evaluate(string exp)" What am I missing to return the proper results? For example I need *(((1+2)/3)*(6-4)) to return 2.*