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 <vector>
using namespace std;

int num(string&, int&);
int term(string&, int&);
int mul(string&, int&);
int expr(string&, int&);

int num(string &s, int &k) {
    int ret = 0;
    while ('0' <= s[k] && s[k] <= '9') {
        ret *= 10;
        ret += s[k] - '0';
        k ++;
    }
    return ret;
}

int term(string &s, int &k) {
    int sym = 1;
    if (s[k] == '+') {
        sym = 1;
        k ++;
    } else if (s[k] == '-') {
        sym = -1;
        k ++;
    }
    int ret;
    if (s[k] == '(') {
        k ++;
        ret = expr(s, k);
        k ++;
    } else {
        ret = num(s, k);
    }
    return sym * ret;
}

int mul(string &s, int &k) {
    int ret = term(s, k);
    if (s[k] == '*') {
        k ++;
        return ret * mul(s, k);
    } else if (s[k] == '/') {
        k ++;
        return ret / mul(s, k);
    }
    return ret;
}

int expr(string &s, int &k) {
    int ret = mul(s, k);
    if (s[k] == '+') {
        k ++;
        return ret + expr(s, k);
    } else if (s[k] == '-') {
        k ++;
        return ret - expr(s, k);
    }
    return ret;
}

int main() {
    int n;
    cin >> n;
    string s;
    while (n--) {
        cin >> s;
        int pos = 0;
        cout << expr(s, pos) << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int roc = 0;
string s;
int insu();
int kou();
int shiki();

int insu() {
	if(s[roc] >= '0' && s[roc] <= '9') {
		int j = roc;
		while(roc < s.size() && s[roc] >= '0' && s[roc] <= '9') ++roc;
		return stoi(s.substr(j, roc - j));
	} else {
		++roc;
		int res = shiki();
		++roc;
		return res;
	}
}

int kou() {
	int res = insu();
	while (s[roc] == '*' || s[roc] == '/') {
		if(s[roc] == '*') res *= insu();
		else res /= insu();
	}
	return res;
}

int shiki() {
	int res = kou();
	while (s[roc] == '+' || s[roc] == '-') {
		if(s[roc] == '+') res += insu();
		else res -= insu();
	}
	return res;
}

int main(void) {
	int n;
	cin>>n;
	REP(roop, n) {
		roc = 0;
		cin>>s;
		s.pop_back();
		cout<<shiki()<<endl;
	}
}

C++: #include <cmath>
#include <cassert>
#include <iostream>

using namespace std;

string S;
size_t cur = 0;

int digit() {
	int n;
	assert(isdigit(S[cur]));
	n = S[cur] -'0';
	++cur;
	return n;
}

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

int expression();
int factor() {
	int n;
	if (S[cur] != '(') n = number();
	else {
		++cur;
		n = expression();
		assert(S[cur] == ')');
	}
	return n;
}

int term() {
	int t = factor();
	while (cur < S.size() && (S[cur] == '*' || S[cur] == '/')) {
		char op = S[cur++];
		int b = factor();
		if(op == '*') t *= b; else t = (int)trunc(1.0*t/b);
	}
	return t;
}


/*int expression() {
	int sum = number();
	while (S[cur] == '+' || S[cur] == '-') {
		char op = S[cur++];
		int b = number();
		if(op == +) sum += b;	else return sum -= b;
	}
	return sum;
}*/

int expression() {
	int sum = term();
	while (cur < S.size() && (S[cur] == '+' || S[cur] == '-')) {
		char op = S[cur++];
		int b = term();
		if(op == '+') sum += b; else sum -= b;
	}
	return sum;
}


int main() {
	int N;
	cin >> N;
	for (int i=0; i<N; ++i) {
		cur = 0;
		cin >> S;
		S.resize(S.size()-1);
		cout << expression() << endl;
	}
	return 0;
}

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

int cur;
string s;

int digit();
int number();
int factor();
int term();
int expression();

int digit() {
	return ( s[cur++] - '0' );
}

int number() {
	int n = digit();
	while ( isdigit( s[cur] ) )
		n = n * 10 + digit();
	return n;
}

int factor() {
	int n;
	if ( s[cur] == '(' ) {
		cur++;
		n = expression();
		cur++;
	} else
		n = number();
	return n;
}

int term() {
	int n = factor();
	while ( s[cur] == '*' || s[cur] == '/' ) {
		cur++;
		if ( s[cur - 1] == '*' )
			n *= factor();
		else
			n /= factor();
	}
	return n;
}

int expression() {
	int n = term();
	while ( s[cur] == '+' || s[cur] == '-' ) {
		cur++;
		if ( s[cur - 1] == '+' )
			n += term();
		else
			n -= term();
	}
	return n;
}

int main() {
	int n;
	cin >> n;
	for ( int i = 0; i < n; i++ ) {
		cur = 0;
		cin >> s;
		int m = expression();
		cout << m << endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>


using namespace std;
typedef long long ll;
const int MODULO = 1000000007;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

int expr(char *& s);

int val(char *& s){
	if(*s == '('){
		s++;
		int ret = expr(s);
		s++;
		return ret;
	}

	int v = 0;
	while(*s >= '0' && *s <= '9'){
		v *= 10;
		v += *s - '0';
		s++;
	}
	return v;
}

int pri(char *& s){
	if(*s == '-'){
		s++;
		return -val(s);
	}
	int l = val(s);
	char ope = *s;
	if(ope != '*' && ope != '/')
		return l;
	s++;
	int r = pri(s);
	if(ope == '*')
		return l*r;
	else
		return l/r;
}

int expr(char *& s){
	int l = pri(s);
	char ope = *s;
	if(ope != '+' && ope != '-')
		return l;
	s++;
	int r = expr(s);
	if(ope == '+')
		return l+r;
	else
		return l-r;
}

void solve()
{
	char s[101];
	cin>>s;
	char *p = s;
	cout << expr(p) << endl;
}

int main(){
	int t; cin>>t;
	while(t--){
		solve();
	}

	return 0;
}

C++: #include <iostream>
#include <cassert>
#define REP(i,l,n) for(int i=l;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define MAX 100
using namespace std;
int ans;
int n,pointer;
char input[MAX];
int evalE();
int evalT();
int evalF();
int main(){
  cin >> n;
  rep(i,n){
    pointer = 0;
    cin >> input;
    ans = evalE();
    cout << ans <<endl;
  }
  return 0;
}
int evalE(){
  int value = evalT();
  while(true){
    if(input[pointer] == '+'){
      pointer++;
      value += evalT();
    }else if(input[pointer] == '-'){
      pointer++;
      value -= evalT();
    }else{
      break;
    }
  }
  return value;
}
int evalT(){
  int value = evalF();
  while(true){
    if(input[pointer] == '*'){
      pointer++;
      value *= evalF();
    }else if(input[pointer] == '/'){
      pointer++;
      value /= evalF();
    }else{
      break;
    }
  }
  return value;
}
int evalF(){
  int value = 0;
  if(input[pointer] == '('){
    pointer++;
    value = evalE();
    assert(input[pointer] == ')');
    pointer++;
  }
  while(input[pointer]>='0'&&input[pointer]<='9'){
    value *= 10;
    value += (int)(input[pointer++] - '0');
  }
  return value;
}