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>

using namespace std;

typedef string::const_iterator State;

struct Parsing {
	int expression(State& it) {
		int res = term(it);
		while (true) {
			if (*it == '+') res += term(++it);
			else if (*it == '-') res -= term(++it);
			else break;
		}
		return res;
	}

	int factor(State& it) {
		int res = 0;
		if (*it == '(') {
			res = expression(++it);
			++it;
		} else res = number(it);
		return res;
	}

	int term(State& it) {
		int res = factor(it);
		while (true) {
			if (*it == '*') res *= factor(++it);
			else if (*it == '/') res /= factor(++it);
			else break;
		}
		return res;
	}

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

int main() {
	int n; cin >> n;
	Parsing solve;
	while (n--) {
		string s; cin >> s;
		State begin = s.begin();
		cout << solve.expression(begin) << 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 l, t;
    string A[101], B[101];
    char s[101];

    scanf("%s", s);
    s[strlen(s)-1] = '\0'; //????°????=?????????

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

    calculate(t, B);

    return 0;
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){

	int n,tmp,op1,work,count;
	char line[101],calc;
	stack<int> NUM,work_num;
	stack<char> OP,work_op;

	bool numFLG,negFLG;

	scanf("%d",&n);

	for(int i = 0; i < n; i++){
		scanf("%s",line);

		tmp = 0;
		numFLG = false;
		negFLG = false;

		for(int k = 0; line[k] != '\0'; k++){
			if(line[k] >= '0' && line[k] <= '9'){
				numFLG = true;
				tmp = 10*tmp + (line[k] - '0');

			}else{

				if(numFLG == true){

					if(negFLG){
						tmp = -1*tmp;
						negFLG = false;
					}

					if(OP.empty() == false && (OP.top() == '*' || OP.top() == '/')){
						calc = OP.top();
						OP.pop();
						op1 = NUM.top();
						NUM.pop();

						if(calc == '*'){
							NUM.push(tmp*op1);
						}else{
							NUM.push(op1/tmp);
						}
					}else{
						NUM.push(tmp);
					}

					numFLG = false;
					tmp = 0;
				}

				if(line[k] == '+' ||line[k] == '*' || line[k] == '/' || line[k] == '('){
					OP.push(line[k]);
				}else if(line[k] == '-'){
					if(k == 0){
						negFLG = true;
					}else if(k > 0 && (line[k-1] == '+' || line[k-1] == '-' || line[k-1] == '*' || line[k-1] == '/' || line[k-1] == '(')){
						negFLG = true;
					}else{
						OP.push('-');
					}

				}else if(line[k] == ')'){

					work = NUM.top();
					NUM.pop();
					work_num.push(work);

					count = 0;

					while(true){
						calc = OP.top();
						OP.pop();
						if(calc == '(')break;

						count++;

						work_op.push(calc);

						work = NUM.top();
						NUM.pop();
						work_num.push(work);
					}

					if(count == 0){
						work = work_num.top();
						work_num.pop();
					}else{

						work = work_num.top();
						work_num.pop();

						while(!work_num.empty()){
							calc = work_op.top();
							work_op.pop();

							if(calc == '+'){
								work += work_num.top();
							}else if(calc == '-'){
								work -= work_num.top();
							}else if(calc == '*'){
								work *= work_num.top();
							}else{
								work /= work_num.top();
							}
							work_num.pop();
						}
					}

					NUM.push(work);

				}else{
					work = NUM.top();
					NUM.pop();
					work_num.push(work);

					while(!NUM.empty()){
						calc = OP.top();
						OP.pop();

						work_op.push(calc);

						work = NUM.top();
						NUM.pop();
						work_num.push(work);
					}

					work = work_num.top();
					work_num.pop();

					while(!work_num.empty()){
						calc = work_op.top();
						work_op.pop();

						if(calc == '+'){
							work += work_num.top();
						}else if(calc == '-'){
							work -= work_num.top();
						}else if(calc == '*'){
							work *= work_num.top();
						}else{
							work /= work_num.top();
						}
						work_num.pop();
					}

					printf("%d\n",work);
				}
			}
		}

	}


	return 0;
}