在C++中用STL实现简单计算器
#include <iostream>
#include <stack>
using namespace std;
int Priority(char ch)
{
switch(ch)
{
case '(':
return 3;
case '*':
case '/':
return 2;
case '+':
case '-':
return 1;
default:
return 0;
}
}
int main()
{
int i = 0, tmp = 0, num1, num2, result;
stack<int> s_opt, s_num;
char opt[64] = {0};
char ch;
cout << "Please input :" << endl;
cin >> opt;
while (opt[i] != '\0' || s_opt.empty() != true)
{
if (opt[i] >= '0' && opt[i] <= '9')
{
tmp = tm