#include<iostream>
#include<cstdio>
#include<stack>
#include<math.h>
using namespace std;
int charToInt(char str[], int n)
{
int count = 0;
for (int i = n - 1; i >= 0; i--)
count += (str[i] - '0')*pow(10, n - 1 - i);
return count;
}
int Compare(stack<char>ope, char ch)//比较运算符的优先级
{
//判断当前优先级是否比栈顶操作符优先级高,操作符压入栈
char top_ope;
if (ope.empty())
top_ope = '&';
else
top_ope = ope.top();
if ((top_ope == '-' || top_ope == '+') && (ch == '*' || ch == '/'))
{
return 0;
}
else if (ope.empty() || ch == '(' || (top_ope == '(' && ch != ')'))
{
return 0;
}
//括号内的表达式计算完毕
else if (top_ope == '(' && ch == ')')
{
return 1;
}
//其他情况则计算
else
{
return -1;
}
}
int Calculate(char a[])
{
stack<int>num;
stack<char>ope;
int i = 0, j = 0, op_num, flag;
char temp[20];
while (a[i] != '