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;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

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

struct Parser {
    // エラー検出
    void consume(State &begin, char expected) {
        if(*begin == expected) begin++;
        else {
            cerr << "Expected '" << expected << "' but got '" << *begin << "'" << endl;
            cerr << "Rest string is '";
            while(*begin) {
                cerr << *begin++;
            }
            cerr << "'" << endl;
            throw ParseError();
        }
    }

    // 数字の列をパースして、その数を返す
    int number(State &begin) {
        int ret = 0;
        while(isdigit(*begin)) {
            ret *= 10;
            ret += (*begin - '0');
            begin++;
        }
        return ret;
    }

    // 括弧か数をパースして、その評価結果を返す
    int factor(State &begin) {
        if(*begin == '(') {
            consume(begin, '(');    // '('を飛ばす
            int ret = expression(begin);
            consume(begin, ')');    // ')'を飛ばす
            return ret;
        }else return number(begin);
    }

    // 乗算除算の式をパースして、その評価結果を返す
    int term(State &begin) {
        int ret = factor(begin);
        while(1) {
            if(*begin == '*') {
                consume(begin, '*');
                ret *= factor(begin);
            }else if(*begin == '/') {
                consume(begin, '/');
                ret /= factor(begin);
            }else break;
        }
        return ret;
    }

    // 四則演算の式をパースして、その評価結果を返す
    int expression(State &begin) {
        int ret = term(begin);
        while(1) {
            if(*begin == '+') {
                consume(begin, '+');
                ret += term(begin);
            }else if(*begin == '-') {
                consume(begin, '-');
                ret -= term(begin);
            }else break;
        }
        return ret;
    }
};

int main() {
    int n; cin >> n;
    cin.ignore();
    for(int i = 0; i < n; ++i) {
        Parser ps;
        string s;
        getline(cin, s);

        State begin = s.begin();
        int ans = ps.expression(begin);
        ps.consume(begin, '=');
        cout << ans << endl;
    }
}

C++: 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <complex>
#include <cctype>
#include <cassert>

using namespace std;

int n;
string S;
int cur;

int digit(){
	assert(isdigit(S[cur]));
	int n = S[cur] - '0';
	cur++;
	return n;
}

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

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

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



int factor(){
	if (S[cur] != '(') return number();
	cur++;
	int n = expression();
	cur++;
	return n;	
}


int main(void){

	cin >> n;

	for(int i = 0; i < n; i++){
		cur = 0;
		cin >> S;
		S.resize(S.size()-1);
		cout << expression() << endl;
	}
	
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int sum(string s,int& i);
int mul(string s,int& i);
int bracket(string s,int& i);
int num(string s,int& i);

bool isdigit(char c){
    int x=c-'0';
    return 0<=x&&x<=9;
}

int sum(string s,int& i){
    int ret=mul(s,i);
    while(s[i]=='+'||s[i]=='-'){
        char op=s[i];
        i++;
        int res=mul(s,i);
        if(op=='+')ret+=res;
        else ret-=res;
    }
    return ret;
}
int mul(string s,int& i){
    int ret=bracket(s,i);
    while(s[i]=='*'||s[i]=='/'){
        char op=s[i];
        i++;
        int res=bracket(s,i);
        if(op=='*')ret*=res;
        else ret/=res;
    }
    return ret;
}

int bracket(string s,int& i){
    if(isdigit(s[i]))return num(s,i);
    i++;
    int ret=sum(s,i);
    i++;
    return ret;
}

int num(string s,int& i){
    int ret=s[i]-'0';
    i++;
    while(isdigit(s[i])){
        ret=10*ret+(int)(s[i]-'0');
        i++;
    }
    return ret;
}

int main(){
    int n;
    cin>>n;
    rep(j,n){
        string s;
        cin>>s;
        int i=0;
        cout<<sum(s,i)<<endl;
    }
}