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 <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[100], B[100];
    char s[10];

    scanf("%s", s);

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

    calculate(t, B);

    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')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')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')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')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;
		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;
	}
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

typedef pair<ll,const char*> parsed;

parsed expr(const char*);
parsed term(const char*);
parsed fact(const char*);

parsed expr(const char* s)
{
	//cout<<"expr(\""<<s<<"\")"<<endl;
	parsed now=term(s);
	while(*now.second=='+' || *now.second=='-'){
		char op=*now.second;
		parsed next=term(now.second+1);
		if(op=='+')
			now=parsed(now.first+next.first,next.second);
		else
			now=parsed(now.first-next.first,next.second);
	}
	//cout<<"expr(\""<<s<<"\")="<<now.first<<endl;
	return now;
}

parsed term(const char* s)
{
	//cout<<"term(\""<<s<<"\")"<<endl;
	parsed now=fact(s);
	while(*now.second=='*' || *now.second=='/'){
		char op=*now.second;
		parsed next=fact(now.second+1);
		if(op=='*')
			now=parsed(now.first*next.first,next.second);
		else
			now=parsed(now.first/next.first,next.second);
	}
	//cout<<"term(\""<<s<<"\")="<<now.first<<endl;
	return now;
}

parsed fact(const char* s)
{
	//cout<<"fact(\""<<s<<"\")"<<endl;
	//if(s[0]=='('){
	//	parsed res=expr(s+1);
	//	res.second++;
	//	return res;
	//}
	//else{
	//	const char* p=s;
	//	if(*p=='-')
	//		p++;
	//	ll n=0;
	//	while(isdigit(*p)){
	//		n=n*10+*p-'0';
	//		p++;
	//	}
	//	return parsed(n,p);
	//}
	
	if(isdigit(s[0])){
		const char* p=s;
		if(*p=='-')
			p++;
		ll n=0;
		while(isdigit(*p)){
			n=n*10+(*p-'0');
			p++;
		}
		return parsed(n,p);
	}
	//else if(s[0]=='('){
	//	parsed res=expr(s+1);
	//	res.second++;
	//	return res;
	//}
	//else
	//	exit(0);
	else{
		parsed res=expr(s+1);
		res.second++;
		return res;
	}
}

int main()
{
	expr("hoge");
	string s;
	getline(cin,s);
	while(getline(cin,s))
		cout<<expr(s.c_str()).first<<endl;
	
	return 0;
}