Language: C++

using namespace std;
string its(int n){
  stringstream s;
  s<<n;
  return s.str();
}
stack<string> mep(stack<string> me,string s){
  int a,b;
  b=atoi(me.top().c_str());
  me.pop();
  a=atoi(me.top().c_str());
  me.pop();
  if(s=="+")
    me.push(its(a+b));
  else if(s=="-")
    me.push(its(a-b));
  else if(s=="*")
    me.push(its(a*b));
  else if(s=="/")
    me.push(its(a/b));
  return me;
}
int main(){
  int h,i,j;
  int n,len;
  string s;
  stack<string> me,st;
  cin>>n;
  for(h=0;h<n;h++){
    cin>>s;
    len=s.length()-1;
    for(i=0;i<len;i++){
      if('1'<=s[i]&&s[i]<='9'){
	for(j=i;j<len;j++)
	  if(s[j]<'0'||'9'<s[j])
	    break;	
	me.push(s.substr(i,j-i));
	i=j-1;
      }else if(s[i]=='('){
	st.push(s.substr(i,1));
      }else if(s[i]==')'){
	while(st.top()!="("){
	  me=mep(me,st.top());
	  st.pop();
	}
	st.pop();
      }else if(s[i]=='+'||s[i]=='-'){
	if(st.empty());
	else if(st.top()=="(");
	else{
	  while(st.empty()==0){
	    if(st.top()=="(")
	      break;
	    else{
	      me=mep(me,st.top());
	      st.pop();
	    }
	  }
	}
	st.push(s.substr(i,1));
      }else if(s[i]=='*'||s[i]=='/'){
	if(st.empty());
	else if(st.top()=="(");
	else if(st.top()=="+"||st.top()=="-");
	else{
	  while(st.empty()==0){
	    if(st.top()=="(")
	      break;
	    else if(st.top()=="+"||st.top()=="-")
	      break;
	    else{
	      me=mep(me,st.top());
	      st.pop();
	    }
	  }
	}
	st.push(s.substr(i,1));
      }
    }
    while(st.empty()==0){
      me=mep(me,st.top());
      st.pop();
    }
    cout<<me.top()<<endl;
    me.pop();
  }
  return 0;
}

Compiler output:
a.cc:2:1: error: 'string' does not name a type
    2 | string its(int n){
      | ^~~~~~
a.cc:7:1: error: 'stack' does not name a type
    7 | stack<string> mep(stack<string> me,string s){
      | ^~~~~
a.cc: In function 'int main()':
a.cc:26:3: error: 'string' was not declared in this scope
   26 |   string s;
      |   ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:27:3: error: 'stack' was not declared in this scope
   27 |   stack<string> me,st;
      |   ^~~~~
a.cc:1:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
  +++ |+#include <stack>
    1 | using namespace std;
a.cc:27:17: error: 'me' was not declared in this scope
   27 |   stack<string> me,st;
      |                 ^~
a.cc:27:20: error: 'st' was not declared in this scope; did you mean 'std'?
   27 |   stack<string> me,st;
      |                    ^~
      |                    std
a.cc:28:3: error: 'cin' was not declared in this scope
   28 |   cin>>n;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:30:10: error: 's' was not declared in this scope
   30 |     cin>>s;
      |          ^
a.cc:43:14: error: 'mep' was not declared in this scope
   43 |           me=mep(me,st.top());
      |              ^~~
a.cc:55:18: error: 'mep' was not declared in this scope
   55 |               me=mep(me,st.top());
      |                  ^~~
a.cc:72:18: error: 'mep' was not declared in this scope
   72 |               me=mep(me,st.top());
      |                  ^~~
a.cc:81:10: error: 'mep' was not declared in this scope
   81 |       me=mep(me,st.top());
      |          ^~~
a.cc:84:5: error: 'cout' was not declared in this scope
   84 |     cout<<me.top()<<endl;
      |     ^~~~
a.cc:84:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:84:21: error: 'endl' was not declared in this scope
   84 |     cout<<me.top()<<endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;