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 <stack>

using namespace std;

int pri(char ch) 
{
    if (ch == '*' || ch == '/')
        return 2;
    if (ch == '+' || ch == '-')
        return 1;
    else
        return 0;
}

int main()
{
    int n;

    cin >> n;

    while (n--) {
        string exp, cha;
        stack<char> pol;
        stack<int> cal;

        cin >> exp;
        for (int i = 0; i < exp.size() - 1; i++) {

            if ('0' <= exp[i] && exp[i] <= '9')
                cha.push_back(exp[i]);
            else if (exp[i] == '(')
                pol.push(exp[i]);
            else if (exp[i] == ')') {
                while (true) {
                    if (pol.top() == '(') {
                        pol.pop();
                        break;
                    }
                    cha.push_back(pol.top());
                    pol.pop();

                }
            }
            else {
                while (!pol.empty()) {
                    if (pri(exp[i]) < pri(pol.top())) {
                        cha.push_back(pol.top());
                        pol.pop();
                    }
                    else 
                        break;
                }
                pol.push(exp[i]);
            }
        }

        while (!pol.empty()) {
            cha.push_back(pol.top());
            pol.pop();
        }

        for (int i = 0; i < cha.size(); i++) {
            if ('0' <= cha[i] && cha[i] <= '9')
                cal.push(cha[i] - '0');
            else {
                int a, b;

                b = cal.top();
                cal.pop();
                a = cal.top();
                cal.pop();

                if (cha[i] == '*') 
                    cal.push(a * b);
                else if (cha[i] == '/') 
                    cal.push(a / b);
                else if (cha[i] == '+') 
                    cal.push(a + b);
                else if (cha[i] == '-') 
                    cal.push(a - b);
            }
        }
        cout << cal.top() << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>
#include <cctype>
using namespace std;
typedef string::const_iterator State;

int number(State &begin);
int term(State &begin);
int expression(State &begin);
int factor(State &begin);

int number(State &begin) {
	int ret = 0;
	
	while (isdigit(*begin)) {
		ret *= 10;
		ret += *begin - '0';
		begin++;
	}
	//cout << "number :: " << ret << endl;
	return ret;
}
int term(State &begin) {
	int ret = number(begin);
	
	while(1) {
		if (*begin == '*') {
			begin++;
			//cout << "go factor // *" << endl;
			ret *= factor(begin);
		}
		else if (*begin == '/') {
			begin++;
			//cout << "go factor // /" << endl;
			ret /= factor(begin);
		}
		else break;
	}
	//cout << "term :: " << ret << endl;
    return ret;
}
int expression(State &begin) {
	int ret = term(begin);
	
	while(1) {
		if (*begin == '+') {
			begin++;
			//cout << "go term // +" << endl;
			ret += term(begin);
		}
		else if (*begin == '-') {
			begin++;
			//cout << "go term // -" << endl;
			ret -= term(begin);
        }
        else break;
	}
	//cout << "expression :: " << ret << endl;
	return ret;
}
int factor(State &begin) {
	if (*begin == '(') {
		begin++; 
		//cout << "go expression" << endl;
		int ret = expression(begin);
		//cout << "factor :: " << ret << endl;
		begin++;
		return ret;
	}
	else return number(begin);
}

int main(void) {
	int n;
	cin >> n;
	cin.ignore();
	for (int i = 0; i < n; i++) {
		string s;
		getline(cin, s);
		
		State begin = s.begin();
		//cout << "Start !!!" << endl;
		cout << expression(begin) << endl;
	}
	return 0;
}

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

using namespace std;

string S;
size_t cur = 0;

char readchar();
char peek();
int digit();
int number();
int expression();
int parse();

int main() {
	int count;
	cin >> count;
	for(int i=0;i<count;i++) {
		cur = 0;
		
		cin >> S;
		//cout << S << endl;
		S.resize(S.size()-1);
		int a = parse();
		cout << a << endl;
	}
	

}


// 1 ??????????????§ cur ????????????
// ??????:?¬???? readchar ??§???????¬???????????????????
char readchar() {
	assert(cur < S.size());
	char ret = S[cur];
	cur += 1;
	return ret;
// return S[cur++]; ??¨????????§???????????¨?????§??????
}
char peek() { // 1 ??????????????? cur ???????????????
	//assert(cur < S.size());
	return S[cur];
}

int digit() {
	assert(isdigit(peek())); // S[cur] ?????°?????§???????????¨????¢????
	int n = readchar() - '0'; // ???0??? ??? 0 ?????????
	return n;
}
int number() {
	int n = digit();
	while (cur < S.size() && isdigit(peek())) // ?¬??????°?????? 1 ????????????
	n = n*10 + digit();
	return n;
}
int expression();

int factor() {
	if (peek() != '(') return number();
	cur += 1;
	int n = expression();
	assert(peek() == ')');
	cur += 1;
	return n;
}

int term() {
	int a = factor();
	while (cur < S.size() && (peek() == '*' || peek() == '/')) {
		char op = readchar();
		int b = factor();
		if (op == '*') a *= b; else a /= b;
	}
	return a;
}

int expression() {
	int a = term();
	while(cur < S.size() && (peek() == '+' || peek() == '-')) {
		char op = readchar();
		int b = term();
		assert((op == '+') || (op == '-'));
		if(op == '+') {
			a+=b;
		} else {
			a-=b;
		}
	}
	return a;
}

int parse() {
	return expression();
}