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<bits/stdc++.h>

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

/*
    Expr = Term {'+'|'-' Term}*
    Term = Fact {'*'|'/' Fact}*
    Fact = Number | '(' Expr ')'
*/

int Fact(int*, std::string);
int Term(int*, std::string);
int Expr(int*, std::string);

int Fact(int* pos, std::string s) {
    int res = 0;
    if(s[*pos] == '(') {
        *pos += 1;
        res = Expr(pos, s);
        *pos += 1;
    } else {
        while(*pos < s.length() && s[*pos] >= '0' && s[*pos] <= '9') {
            res *= 10;
            res += (int)(s[*pos] - '0');
            *pos += 1;
        }
    }
    return res;
}

int Term(int* pos, std::string s) {
    int fact = Fact(pos, s);
    if(*pos >= s.length()) return fact;
    while( *pos < s.length() && (s[*pos] == '*' || s[*pos] == '/') ) {
        char op = s[*pos];
        *pos += 1;

        int nfact = Fact(pos, s);
        if(op == '*') {
            fact *= nfact;
        } else {
            fact /= nfact;
        }
    }
    return fact;
}

int Expr(int* pos, std::string s) {
    int term = Term(pos, s);
    if(*pos >= s.length()) return term;
    while( *pos < s.length() && (s[*pos] == '+' || s[*pos] == '-') ) {
        char op = s[*pos];
        *pos += 1;

        int nterm = Term(pos, s);
        if(op == '+') {
            term += nterm;
        } else {
            term -= nterm;
        }
    }
    return term;
}

int main() {
    int N;
    std::string str;
    std::cin >> N;
    REP(i, N) {
        int pos = 0;
        std::cin >> str;
        std::cout << Expr(&pos, str) << std::endl;
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>

using namespace std;

char siki[200];
int cur;


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

int number(){
  int n=digit();
  while(cur<strlen(siki) && isdigit(siki[cur]))
    n=n*10+digit();

  return n;
}

int factor();

int term(){
  int a=factor();
  while(cur<strlen(siki) && (siki[cur]=='*' || siki[cur]=='/')){
    char op=siki[cur];
    ++cur;
    int b=factor();
    if(op=='*')a*=b;else a/=b;
  }
  return a;
}

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

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

int main(){
  int n;
  cin>>n;

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

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

int p;
string str;

int Term();
int Factor();
int Elem();
int Digit();

int Term() {
  int a = Factor();
  while (str[p] == '+' || str[p] == '-') {
    char c = str[p];
    p++; // read [+-]
    int b = Factor();
    if (c == '+') {
      a = a + b;
    } else {
      a = a - b;
    }
  }
  return a;
}

int Factor() {
  int a = Elem();
  while (str[p] == '*' || str[p] == '/') {
    char c = str[p];
    p++; // read [*/]
    int b = Factor();
    if (c == '*') {
      a = a * b;
    } else {
      a = a / b;
    }
  }
  return a;
}

int Elem() {
  if (str[p] == '(') {
    p++; // read (
    int a = Term();
    p++; // read )
    return a;
  } else {
    int a = 0;
    while (isdigit(str[p])) {
      int b = Digit();
      a = 10 * a + b;
    }
    return a;
  }
}

int Digit() {
  int a = str[p] - '0';
  p++; // read [0-9]
  return a;
};

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> str;
    p = 0;
    cout << Term() << endl;
  }
}

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

int exp();
int term();
int factor();
string str;
int p;

int factor(){
  int val=0;
  while(str[p]>='0' && str[p]<='9'){ 
    val*=10;
    val+=str[p]-'0';
    p++;
  }
  if(val!=0) return val;
  else  if(str[p]=='('){
    p++;
    val=exp();
  }
  if(str[p]==')'){
    p++;
  return val;
  }

if(val==0) return 0;
}

int term(){
  int val=factor();
  while(str[p]=='*' || str[p]=='/'){
  if(str[p]=='*'){
      p++;
      val*=factor();
    }else if(str[p]=='/'){
      p++;
      val/=factor();
    }
 }
 return val;
}

int exp(){
  int val=term();
  while(str[p]=='+' || str[p]=='-'){
    if(str[p]=='+'){
      p++;
      val+=term();
    }else if(str[p]=='-'){
      p++;
      val-=term();
    }
  }
  return val;
}


int main(){
  int n;
  
  cin>>n;
  for(int i=0;i<n;i++){
    p=0;
    cin>>str;
    cout<<exp()<<endl;
  }
  return 0;
}