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>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

typedef string::const_iterator State;
int number(State&);
int factor(State&);
int term(State&);
int expression(State&);

// ??°??????????????????????????????????????°????????????
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);
    }
    return -1;
}

// ?????????????????????????????????????????????????????????????????????
int term(State &begin) {
    int ret = factor(begin);

    for (;;) {
        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);

    for (;;) {
        if (*begin == '+') {
            begin++;
            ret += term(begin);
        } else if (*begin == '-') {
            begin++;
            ret -= term(begin);
        } else {
            break;
        }
    }

    return ret;
}

int main(){
    int t;
    cin >> t;
    while(t--){
        string s;
        cin >> s;
        s.erase(--s.end());
        State tmp = s.begin();
        cout << expression(tmp) << endl;
    }
}

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

using namespace std;

// 1+(4-25)*3= => ["1", "+", "(", "4", "-", "25", ")", "*", "3", "="]
void str2arr(string s, string A[]) {
    int n = 0;
    string tmp = "";

    for (int i = 0; s[i] != '=' ; i++) {
        if ('0' <= s[i] && s[i] <= '9') {
            tmp += s[i];
        }
        else {
            if (tmp != "") { 
                A[n++] = tmp;
                tmp = "";
            }
            A[n++] = s[i];
        }
    }
    if (tmp != "") { A[n++] = tmp; }
    A[n++] = "=";
}

// generate Reverse Polish Notation

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

    int i, j = 0;
    for (i = 0; A[i] != "="; i++) {
        if ('0' <= A[i][0] && A[i][0] <= '9') {
            B[j++] = A[i];
        }

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

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

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

int main() {
    int n;
    string A[100], B[100];
    string in;

    cin >> n;

    while (n--) {
        cin >> in;
        str2arr(in, A);
        Generate_RPN(A, B);
        cout << Calculate_RPN(B) << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<queue>
#define int long long
using namespace std;

string Erase(string a, int b, int c,string e) {//b???????????????c??????????????§????¶????
	string d;
	for (int i = 0; i < b; i++) {
		d += a[i];
	}
	d += e;
	for (int i = c+1; i < a.length(); i++) {
		d += a[i];
	}
	return d;
}
string kake(string a) {
	int b = 1; a = "*" + a;
	for (int c = 0; c < a.length(); c++) {
		int e = c+1;
		if (a[c] == '*') {
			string d;
			for (; e < a.length(); e++) {
				if (a[e] >= '0'&&a[e] <= '9' || a[e] == '-')d += a[e];
				else break;
			}
			b *= stoi(d);
		}
		else if (a[c] == '/') {
			string d;
			for (; e < a.length(); e++) {
				if (a[e] >= '0'&&a[e] <= '9' || a[e] == '-')d += a[e];
				else break;
			}
			b /= stoi(d);
		}
		c = e - 1;
	}
	return to_string(b);
}
string tasi(string a) {
	int b = 0; a = "+" + a;
	for (int c = 0; c < a.length(); c++) {
		int e = c + 1;
		if (a[c] == '+') {
			string d;
			for (; e < a.length(); e++) {
				if (a[e] >= '0'&&a[e] <= '9'||a[e]=='-')d += a[e];
				else break;
			}
			b += stoi(d);
		}
		else if (a[c] == '%') {
			string d;
			for (; e < a.length(); e++) {
				if (a[e] >= '0'&&a[e] <= '9' || a[e] == '-')d += a[e];
				else break;
			}
			b -= stoi(d);
		}
		c = e - 1;
	}
	return to_string(b);
}
string keisan(string a) {
	vector<string>V;
	string b;
	for (char c : a) {
		if (c == '+' || c == '%') {
			V.push_back(b);
			b = ""; b += c;
			V.push_back(b);
			b = "";
		}
		else b += c;
	}
	V.push_back(b);
	for (int i = 0; i < V.size(); i += 2) {
		V[i] = kake(V[i]);
	}
	string S;
	for (int i = 0; i < V.size(); i++) {
		S += V[i];
	}
	return tasi(S);
}
signed main(){
	int a; cin >> a;
	for (int b = 0; b < a; b++) {
		string c; cin >> c;
		for (int d = 1; d < c.length(); d++) {
			if (c[d - 1] >= '0'&&c[d - 1] <= '9') {
				if (c[d] == '-') {
					c[d] = '%';
				}
			}
		}
		c = c.substr(0, c.length() - 1);
		c = "(" + c + ")";
		while (1) {
			bool s = false;//????????????????????? ( ?????????0
			int last = 0;
			for (int i = 0; i < c.length(); i++) {
				if (c[i] == '(') {
					s = false;
					last = i;
				}
				if (c[i] == ')') {
					if (!s) {
						c = Erase(c, last, i, keisan(c.substr(last+1,i-last-1)));
						break;
					}
					s = true;
				}
				if (i == c.length() - 1) { goto l; }
			}
		}
	l:;
		cout << c << endl;
	}
}