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>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int number(State &begin){
    int ret = 0;
    while(isdigit(*begin)){
        ret *= 10;
        ret += *begin - '0';
        begin++;
    }
    return ret;
}
int term(State &begin){
    int ret = number(begin);
    while(1){
        if(*begin == '*'){
            begin++;
            ret *=  number(begin);
        }else if(*begin == '/'){
            begin++;
            ret /= number(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;
}
int main(){
    string s;
    CIN(N);
    REP(a,N){
        cin >> s;
        State w = s.begin();
        COUT(expression(w));
    }
    return 0;
}

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

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

using namespace std;

int expression(State&);
int term(State&);
int number(State&);
int factor(State&);
void consume(State&);

// begin???expected?????????????????????begin?????????????????????
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 expression(State &begin) {
	int ret = term(begin);
	//cout << "e:" << *begin << endl;
	while(1) {
		if(*begin == '+') {
			begin++;
			ret += term(begin);
		} else if(*begin == '-') {
			begin++;
			ret -= term(begin);
		} else {
			break;
		}
	}
	
	return ret;
}

int term(State &begin) {
	int ret = factor(begin);
	//cout << "t:" << *begin << endl;
	while(1) {
		if(*begin == '*') {
			begin++;
			ret *= factor(begin);
		} else if(*begin == '/') {
			begin++;
			ret /= factor(begin);
		} else {
			break;
		}
	}
	
	return ret;
}

int number(State &begin) {
	int ret = 0;
	//cout << "n:" << *begin << endl;
	while(isdigit(*begin)) {
		ret *= 10;
		ret += *begin - '0';
		begin++;
	}
	
	return ret;
}

int factor(State &begin) {
	//cout << "f:" << *begin << endl;
	if(*begin == '(') {
		begin++;
		int ret = expression(begin);
		begin++;
	} else {
		return number(begin);
	}
}

int main() {
	int n;
	cin >> n;
	cin.ignore();
	for(int i=0; i<n; ++i) {
		string s;
		getline(cin, s);
		
		State begin = s.begin();
		int ans = expression(begin);
		consume(begin, '=');
		cout << ans << 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;
}