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 <cstring>
#include <cctype>
#include <iostream>
#include <cstdio>
using namespace std;

int exp(char* & p);

int num(char* & p) {
    int ret = 0;
    while (isdigit(*p)) {
        ret *= 10;
        ret += *p - '0';
        p++;
    }
    return ret;
}

int fac(char* & p) {
    int ret = 0;
    if (*p == '(') {
        p++;
        ret += exp(p);
        p++;
    } else {
        ret += num(p);
    }
    return ret;
}

int term(char* & p) {
    int ret = fac(p);
    while(1) {
        if (*p == '*') {
            p++;
            ret *= fac(p);
        } else if (*p == '/') {
            p++;
            ret /= fac(p);
        } else {
            break;
        }
    }
    return ret;
}

int exp(char* & p) {
    int ret = term(p);
    while(1) {
        if (*p == '+') {
            p++;
            ret += term(p);
        } else if (*p == '-') {
            p++;
            ret -= term(p);
        } else break;
    }
    return ret;
}

int eval(const string & s){
    char* p = (char*)s.c_str();
    return exp(p);
}

int eval(const char* str){
    char* p = (char*)str;
    return exp(p);
}

using namespace std;

int main(){
    char str[128];
    while(gets(str))
        cout << eval(str) << endl;
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <cctype>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

typedef string::const_iterator State;
class ParseError {};

struct Parser {
    // ??°?????????????????????
    int number(State &begin) {
        int ret = 0;
        while(isdigit(*begin)) {
            ret *= 10;
            ret += (*begin - '0');
            begin++;
        }
        return ret;
    }

    // ??¬??§?????°????????????
    int factor(State &begin) {
        if(*begin == '(') {
            begin++; // '(' ????£???°???
            int ret = expression(begin);
            begin++; // ')' ????£???°???
            return ret;
        }
        else return number(begin);
    }

    // ??????????????????????????????
    int term(State &begin) {
        // ????????????????????¨????????£????????°??????????????§???????????????
        // begin ?????????????????°?????§???????????????
        int ret = factor(begin);

        while(1) {
            if(*begin == '*') {
                begin++;
                ret *= factor(begin);
            }
            else if(*begin == '/') {
                begin++;
                ret /= factor(begin);
            }
            else break;
        }

        return ret;
    }

    // ??????????????????????????????
    int expression(State &begin) {
        int ret = term(begin);
        while(1) {
            if(*begin == '+') {
                begin++;
                ret += term(begin);
            }
            else if(*begin == '-') {
                begin++;
                ret -= term(begin);
            }
            else break;
        }
        return ret;
    }
};

signed main() {
    int N; cin >> N;
    rep(i,0,N) {
        Parser ps;
        string s; cin >> s;
        State begin = s.begin();
        int ans = ps.expression(begin);
        cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cctype>

using namespace std;

int number(const string &s, int &k);
int fact(const string &s, int &k);
int term(const string &s, int &k);

int expr(const string &s, int &k){
  int result = term(s,k);
  while(true){
    if(s[k]=='+')result += term(s,++k);
    else if(s[k]=='-')result -= term(s,++k);
    else break;
  }
  return result;
}

int term(const string &s, int &k){
  int res = fact(s,k);
  while(true){
    if(s[k]=='*')return res *= fact(s,++k);
    else if(s[k]=='/')return res /= fact(s,++k);
    else break;
  }
  return res;
}

int fact(const string &s, int &k){
  if(s[k]=='('){
    int res = 0;
    ++k;
    res = expr(s,k);
    k++;
    return res;
  }
  return number(s,k);
}

int number(const string &s, int &k){
  int res = 0;
  while(isdigit(s[k])){
    res *= 10;
    res += (int)(s[k++] - '0');
  }
  return res;
}

int main(void){

  int n;
  cin >> n;

  while(n--){
    string s;
    cin >> s;
    int k = 0;
    cout << expr(s, k) << endl;
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
LL plusub(void);
LL muldiv(void);
LL parent(void);
LL number(void);

int ind;
string str;

LL plusub(void){
  LL a=muldiv();
  if(str[ind]=='+'){
    ++ind;
    return a+plusub();
  }else if(str[ind]=='-'){
    ++ind;
    return a-plusub();
  }else return a;
}

LL muldiv(void){
  LL a=parent();
  if(str[ind]=='*'){
    ++ind;
    return a*muldiv();
  }else if(str[ind]=='/'){
    ++ind;
    return a/muldiv();
  }else return a;
}

LL parent(void){
  if(str[ind]=='('){
    ++ind;
    LL a=plusub();
    ++ind;
    return a;
  }else return number();
}

LL number(void){
  if('0'<=str[ind] && str[ind]<='9'){
    LL a=str[ind]-'0';
    ++ind;
    LL b=number();
    if(0<=b) return a*10+b;
    else return a;
  }else return -1;
}

int main(void)
{
  int n;
  cin >> n;
  REP(i,n){
    ind=0;
    cin >> str;
    cout << plusub() << endl;
  }
  return 0;
}