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

// ??§????????°
string S;
size_t cur = 0; // ?§£???????§???????

// ?¬??????°??????????????¢??°
int digit(){
    assert(isdigit(S[cur]));
    int n = S[cur] - '0'; // ASCII?????????????????¨?????????'0'???0?????????
    cur = cur + 1;
    return n;
}

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

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

// ()???????????°????????????????????¨???????¨????????????¢??°
int factor(){
    if(S[cur] != '('){
        return number();
    }
    cur += 1;
    int n = expression();
    assert(S[cur] == ')');
    cur += 1;
    return n;
}

// 0?????\?????????????????????????????????????????¨??????????¨????????????¢??°
int term(){
    int a = factor();
    while(cur < S.size() && (S[cur] == '*' || S[cur] == '/')){ // ?¬????number???????????¨???????¨????????????????????????????cur++???????????????????????????????????¨????????§??????
        char op = S[cur++]; // cur???????????§??????+1?????????
        int b = factor();
        if(op == '*'){
            a *= b;
        } else {
            a /= b;
        }
    }
    return a;
}

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

int parse(){
    return expression();
}

int main(){
    int N;
    cin >> N;
    for(int i=0; i<N; ++i){
        cur = 0;
        cin >> S;
        S.resize(S.size()-1); // ?????????=?????????

        int a = parse();
        assert(cur == S.size());

        cout << a << endl;
    }
}

C++: #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する

typedef string::const_iterator State;

int expression(State &begin);

int term(State &begin);

int factor(State &begin);

int number(State &begin);

int expression(State &begin) {
    int ret = term(begin);
    while (true) {
        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);
    while (true) {
        if (*begin == '*') {
            begin++;
            ret *= factor(begin);
        } else if (*begin == '/') {
            begin++;
            ret /= factor(begin);
        } else {
            break;
        }
    }
    return ret;
}

int factor(State &begin) {
    if (*begin == '(') {
        begin++;
        int ret = expression(begin);
        begin++;
        return ret;
    }
    return number(begin);
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    cin.ignore();
    while (N--) {
        string s;
        getline(cin, s);
//        cin.ignore();
        State begin = s.begin();
        int ans = expression(begin);
        cout << ans << endl;
    }


    return 0;
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <map>
#include <cstdlib>
#include <cctype>
#include <cstdio>
#include <cstring>

using namespace std;

int str2arr(char s[], string A[]) {
    bool flag = true;
    string t;
    int l = strlen(s);
    int i, n = 0;
    for (i = 0; i < l; i++) {
        if (isdigit(s[i]) && flag) {
            t = "";
            int j = 0;
            while (isdigit(s[i + j])) {
                t += s[i + j];
                if (i + j == l - 1)
                    break;
                j++;
            }
            A[n++] = t;
            flag = false;
        }
        else if (!isdigit(s[i])) {
            A[n++] = s[i];
            flag = true;
        }
    }
    return n;
}

int Generate_RPN(int n, string A[], string B[]) {
    map<string, int> table;
    table["*"] = 1;
    table["/"] = 1;
    table["+"] = 0;
    table["-"] = 0;
    table["("] = -1;
    table[")"] = -1;
    stack<string> S;
    int j = 0;

    for (int i = 0; i < n; i++) {
        if (isdigit(A[i][0])) {
            B[j++] = A[i];
        }

        else if (A[i] == "(")
            S.push(A[i]);

        else if (A[i] == ")") {
            while (S.top() != "(") {
                B[j++] = S.top();
                S.pop();
            }
            S.pop();
        }
        else {
            while ((!S.empty()) && (table[S.top()] >= table[A[i]])) {
                B[j++] = S.top();
                S.pop();
            }
            S.push(A[i]);
        }
    }
    while (!S.empty()) {
        B[j++] = S.top();
        S.pop();
    }
    return j;
}

void calculate(int n, string s[]) {
    stack<double> St;
    double a, b;

    for (int i = 0; i < n; i++) {
        if (s[i] == "+") {
            b = St.top(); St.pop();
            a = St.top(); St.pop();
            St.push(a+b);
        }
        else if (s[i] == "-") {
            b = St.top(); St.pop();
            a = St.top(); St.pop();
            St.push(a+b);
        }
        else if (s[i] == "*") {
            b = St.top(); St.pop();
            a = St.top(); St.pop();
            St.push(a*b);
        }
        else if (s[i] == "/") {
            b = St.top(); St.pop();
            a = St.top(); St.pop();
            St.push(a/b);
        }
        else {
            St.push(atoi(s[i].c_str()));
        }
    }
    cout << int(St.top()) << endl;
}

int main()
{
    int n, l, t;
    string A[101], B[101];
    char s[101];

    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        s[0] = '\0';
        scanf("%s", s);
        s[strlen(s)-1] = '\0'; //????°????=?????????

        l = str2arr(s, A);
        t = Generate_RPN(l, A, B);

        calculate(t, B);
    }

    return 0;
}