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 <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int ???(string& s, int& i);
int ???(string& s, int& i);
int ?????°(string& s, int& i);
int ??°(string& s, int& i);

int ???(string& s,int& i) {
	int a = ???(s, i);
	while (s[i] == '+' || s[i] == '-') {
		char op = s[i];
		i++;
		int b = ???(s, i);
		if (op == '+') {
			a = a+b;
		}
		else {
			a = a - b;
		}
	}
	return a;
}

int ???(string& s, int& i) {
	int a = ?????°(s, i);
	while (s[i] == '*' || s[i] == '/') {
		char op = s[i];
		i++;
		int b = ?????°(s, i);
		if (op == '*') {
			a = a*b;
		}
		else {
			a = a / b;
		}
	}
	return a;
}

int ?????°(string& s, int& i) {
	if (isdigit(s[i])) {
		int a = ??°(s, i);
		return a;
	}
	else {
		i++;//(
		int a = ???(s, i);
		i++;//)
		return a;
	}
}

int ??°(string& s, int& i) {
	int a = s[i]-'0';
	i++;
	while (isdigit(s[i])) {
		a = a * 10 + (s[i] - '0');
		i++;
	}
	return a;
}

int main()
{
	int n;
	cin >> n;
	REP(j, n) {
		string ss;
		cin >> ss;
		int k = 0;
		cout << ???(ss, k) << endl;
	}

}

C++: #include <bits/stdc++.h>
using namespace std;
string s;
int p,n;
int bnf1();
int g_A(){
  int r=0;
  if(s[p]=='(')p++,r=bnf1(),p++;
  else
    while(isdigit(s[p])) r=r*10+(s[p++]-'0');
  return r;
}
int bnf2(){
  int res=g_A();
  while(s[p]=='*'||s[p]=='/'){
    int t=p++;
    if(s[t]=='*')res*=g_A();
    if(s[t]=='/')res/=g_A();
  }
  return res;
}
int bnf1(){
  int res=bnf2();
  while(s[p]=='+'||s[p]=='-'){
    int t=p++;
    if(s[t]=='+')res+=bnf2();
    if(s[t]=='-')res-=bnf2();
  }
  return res;
}
int main(){
  cin>>n;
  while(n--){
    cin>>s;
    p=0;
    cout<<bnf1()<<endl;
  }
}

C++: #include<iostream>
#include<queue>
#include<cctype>
#include<cassert>
#include<cstdlib>

using namespace std;

queue<string>exp;

int calculate();
int add();
int multiply();
int term();

int calculate()
{
  return add();
}

int add()
{
  int num=multiply();
  if(exp.empty())return num;
  string s=exp.front();
  if(s[0]=='+'||s[0]=='-'){
    exp.pop();
    int num2=calculate();
    if(s[0]=='+')return num+num2;
    if(s[0]=='-')return num-num2;
  }
  return num;
}

int multiply()
{
  int num=term();
  if(exp.empty())return num;
  string s=exp.front();
  if(s[0]=='*'||s[0]=='/'){
    exp.pop();
    int num2=calculate();
    if(s[0]=='*')return num*num2;
    if(s[0]=='/')return num/num2;
  }
  return num;
}

int term()
{
  string s=exp.front();
  if(isdigit(s[0])){
    exp.pop();
    return atoi(s.c_str());
  }
  if(s[0]=='('){
    exp.pop();
    int num=calculate();
    assert(exp.front()==")");
    exp.pop();
    return num;
  }
}

int main()
{
  int n;
  string s;
  cin>>n;
  while(n-->0){
    cin>>s;
    while(exp.size())exp.pop();
    for(int i=0;i<s.size();i++){
      if(s[i]=='=')break;
      if(isdigit(s[i])){
	int j;
	for(j=i+1;j<s.size();j++)if(!isdigit(s[j]))break;
	exp.push(s.substr(i,j-i));
	i=j-1;
      }else{
	exp.push(s.substr(i,1));
      }
    }
    cout<<calculate()<<endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<queue>
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);
}
int 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 <string>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
int expression(State &begin);
int term(State &begin);
int factor(State &begin);
int number(State &begin);
int expression(State &begin){
	int ret=term(begin);
	while(true){
		if(*begin == '+'){
			begin++;
			ret+=term(begin);
		}else if(*begin == '-'){
			begin++;
			ret-=term(begin);
		}else{
			break;
		}
	}
	return ret;
}
int term(State &begin){
	int ret=factor(begin);
	while(true){
		if(*begin == '*'){
			begin++;
			ret*=factor(begin);
		}else if(*begin == '/'){
			begin++;
			ret/=factor(begin);
		}else{
			break;
		}
	}
	return ret;
}
int number(State &begin){
	int ret=0;
	while(isdigit(*begin)){
		ret*=10;
		ret+= (*begin) -'0';
		begin++;
	}
	return ret;
}
int factor(State &begin){
	if(*begin == '('){
		begin++;
		int ret=expression(begin);
		begin++;
		return ret;
	}else{
		return number(begin);
	}
}
int main(){
	int n;
	cin >> n;
	cin.ignore();
	for(int i=0;i<n;i++){
		string s;
		getline(cin,s);
		State begin=s.begin();
		int ans=expression(begin);
		cout << ans << endl;
	}
	return 0;
}