Go: package main

import (
	"bufio"
	"fmt"
	"go/token"
	"go/types"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	for i := 0; i < n; i++ {
		stdin.Scan()
		exp := strings.TrimRight(stdin.Text(), "=")
		res, _ := types.Eval(token.NewFileSet(), nil, token.NoPos, exp)
		fmt.Println(res.Value)
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;

char s[125];
int it;

int dfs(){
  int ret = 0;
  int tail = 0;
  int sign = 1;
  // first operand
  int a = 0;
  if(s[it]=='('){
    it++;
    a = dfs();
    assert(s[it]==')');
    it++;
  }else{
    while(isdigit(s[it])){
      a *= 10;
      a += s[it]-'0';
      it++;
    }
  }
  tail = a;
  while(true){
    // operator
    char op = s[it];
    if(op == '=' || op == ')'){
      // end
      ret += sign * tail;
      return ret;
    }
    it++;
    // second operand
    int b = 0;
    if(s[it]=='('){
      it++;
      b = dfs();
      assert(s[it]==')');
      it++;
    }else{
      while(isdigit(s[it])){
        b *= 10;
        b += s[it]-'0';
        it++;
      }
    }
    if(op == '+' || op == '-'){
      // tail end
      ret += sign * tail;
      tail = b;
      sign = op=='+' ? 1 : -1;
    }else if(op == '*'){
      tail *= b;
    }else if(op == '/'){
      tail /= b;
    }
  }
}

void solve(){
  REP(i,125)s[i] = '\0';
  scanf("%s",s);
  it = 0;
  int ans = dfs();
  printf("%d\n",ans);
}

int main(){
  int t;
  scanf("%d",&t);
  while(t--)solve();
}

C++: #include <bits/stdc++.h>

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

string str;
int expr(int &idx);
int factor(int &idx);
int primary(int &idx);
int inum(int &idx);

// expr ::= factor | expr '+' factor | expr '-' factor
int expr(int &idx){
	auto ret = factor(idx);
	while(str[idx] != ')' && str[idx] != '='){
		auto op = str[idx];
		auto rest = factor(++idx);
		if(op == '+'){
			ret += rest;
		}
		else if(op == '-'){
			ret -= rest;
		}
		else{
//			cerr << op << endl;
			assert(0);
		}
	}
	return ret;
}


// factor ::= primary | factor '*' primary | factor '/' primary
int factor(int &idx){
	auto ret = primary(idx);
	while(str[idx] == '*' || str[idx] == '/'){
		auto op = str[idx];
		auto rest = primary(++idx);
		if(op == '*') ret *= rest;
		else if(op == '/') ret /= rest;
		else{
//			cerr << op << endl;
			assert(0);
		}
	}
	return ret;
}

// primary ::= '(' expr ')' | num
int primary(int &idx){
	int ret;
//	cerr << idx << ":" << str[idx] << endl;
	if(str[idx] == '('){
		ret = expr(++idx);
		assert(str[idx] == ')');
		idx++;
		return ret;
	}
	if(isdigit(str[idx])){
		return inum(idx);
	}
	assert(0);
	return -1;
}

int inum(int &idx){
	assert(isdigit(str[idx]));
	int i = idx;
	while(isdigit(str[idx]))idx++;
	return stoi(str.substr(i,idx-i));
}

signed main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		cin >> str;
		int idx =0 ;
		cout << expr(idx) << endl;
	}

	return 0;
}

C++: //
//AOJ vol1 109
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0109&lang=jp
//2017/07/10
//640009E
//Yang Bo
//

#include <iostream>
#include <cctype>

using namespace std;

string S;
size_t cur = 0;

//string?????°??????int???"??°???"???????????????
int digit()
{
  int n = S[cur] - '0';
  cur = cur + 1; //cur?????????????????????????????????(?¬??????°??????)
  return n;
}

//?????????????????????????????????????????????????????????
int number()
{
  int n = digit();
  while (cur < S.size() && isdigit(S[cur])) //?????¨?????¨???????????°
    n = n * 10 + digit();
  return n;
}

int expression(); //??£?¨?

//??¬??§????????§?????????
int bracket()
{
  if (S[cur] != '(')
    return number();
  cur++;
  int n = expression();
  cur++; //')'??????????????????????????????
  return n;
}

//????????????????????????
int term()
{
  int a = bracket(); //????????????????????°
  while (cur < S.size() && (S[cur] == '*' || S[cur] == '/')) {
    char op = S[cur++];
    int b = bracket(); //???????????????????????°(?¶????????????°?????????)
    if (op == '*')
      a *= b;
    else if (op == '/')
      a /= b;
  }
  return a;
}

//????????????????????????
int expression()
{
  int a = term(); //????????????????????°
  while (cur < S.size() && (S[cur] == '+' || S[cur] == '-')) {
    char op = S[cur++]; //cur?????????????????????????????????(?????????????????????)
    int b = term(); //???????????????????????°(?¶????????????°?????????)
    if (op == '+')
      a += b;
    else if (op == '-')
      a -= b;
  }
  return a;
}

int main()
{
  int n; cin >> n;
  while (n-- > 0) {
  cin >> S;
  int a = expression();
  cout << a << endl;
  }
}

/*
?????£??¨?????????????????´??\??\??????????????????????????????????????¨????????????????????§????????????????????????????????£????????§?????????
?????????????????????????§????????????§????????±????????????????????????????§£???????????????
(11.A??????????????????????????§????????????????§£?????????????????????????????£???????????£????????????????????????)
????????¨?????\????????????????????£???Encryption System?????¢??????????????£????????§????????????????????¨???????§£??????????????????
*/