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<map>
using namespace std;
#define ans pair<int, int>
string s;
ans equation(int p);
ans factor(int p);
ans term(int p);
int main(){
  int n;
  cin >>n;
  while(n--){
    cin >>s;
    ans r = equation(0);
    cout <<r.first<<endl;
  }
  return 0;
}
ans equation(int p){
  ans r = factor(p);
  while(s[r.second] == '+' || s[r.second] == '-'){
    ans r_dash = factor(r.second+1);
    if(s[r.second] == '+'){r.first += r_dash.first;}
    if(s[r.second] == '-'){r.first -= r_dash.first;}
    r.second = r_dash.second;
  }
  return r;
}
ans factor(int p){
  ans r = term(p);
  while(s[r.second] == '*' || s[r.second] == '/'){
    ans r_dash = term(r.second+1);
    if(s[r.second] == '*'){r.first *= r_dash.first;}
    if(s[r.second] == '/'){r.first /= r_dash.first;}
    r.second = r_dash.second;
  }
  return r;
}
ans term(int p){
  if(s[p] == '('){
    ans r = equation(p+1);
    r.second++;
    return r;
  }
  else{
    int v = 0;
    while(isdigit(s[p])){
      v = v*10+s[p++]-'0';
    }
    return ans(v,p);
  }
}

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

string S;
size_t cur;

int digit() {
  assert(isdigit(S[cur])); // S[cur]が数字でなければストップ。正しく動作すれば実行されない。
  int 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 factor();
int term() {
  int a = factor();
  while (cur < S.size() && (S[cur] == '*' || S[cur] == '/')) {
    char op = S[cur++];
    int b = factor();
    if (op == '*') {
      a *= b;
    } else {
      a /= b;
    }
  }
  return a;
}

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

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

int parse() { return expression(); }

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

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

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 vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

// <expression> := <fomula>( ( '+' | '-' )<fomula> )+ '='
// <fomula> := <atom>( ( '*' | '/' )<atom> )+
// <atom> := '('<expression>')' | <number>
// <number> := ( '0' | '1' | ... | '9' )+

PII expression( const string &, int p );
PII fomula( const string &, int p );
PII atom( const string &, int p );
PII number( const string &, int p );

PII expression( const string &s, int p = 0 )
{
	PII res = fomula( s, p );
	while ( string( "+-" ).find( s[ res.snd ] ) != string::npos )
	{
		PII r = fomula( s, res.snd + 1 );
		res.fst += ( s[ res.snd ] == '+' ? 1 : -1 ) * r.fst;
		res.snd = r.snd;
	}
	return res;
}

PII fomula( const string &s, int p = 0 )
{
	PII res = atom( s, p );
	while ( string( "*/" ).find( s[ res.snd ] ) != string::npos )
	{
		PII r = s[ res.snd + 1 ] == '(' ? expression( s, res.snd + 2 ) : number( s, res.snd + 1 );
		if ( s[ res.snd ] == '*' )
		{
			res.fst *= r.fst;
		}
		else
		{
			res.fst /= r.fst;
		}
		res.snd = r.snd;
	}
	return res;
}

PII atom( const string &s, const int p = 0 )
{
	if ( s[p] == '(' )
	{
		PII res = expression( s, p + 1 );
		res.snd ++;
		return res;
	}
	else
	{
		return number( s, p );
	}
}

PII number( const string &s, int p )
{
	int res = 0;
	while ( isdigit( s[p] ) )
	{
		res *= 10;
		res += s[ p++ ] - '0';
	}
	return MP( res, p );
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	int n;
	cin >> n;

	REP( i, 0, n )
	{
		string line;
		cin >> line;
		cout << expression( line ).fst << endl;
	}

	return 0;
}