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<sstream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

string in; int n;

int eval(int s,int t){
  int i,d=0;
  for(i=t-1;i>=s;i--){
    if(in[i]==')')d++;
    else if(in[i]=='(')d--;
    if(d==0&&(in[i]=='+'||in[i]=='-'))break;
  }
  if(i>=s){
    int a=eval(s,i),b=eval(i+1,t);
    return in[i]=='+'?a+b:a-b;
  }
  d=0;
  for(i=t-1;i>=s;i--){
    if(in[i]==')')d++;
    else if(in[i]=='(')d--;
    if(d==0&&(in[i]=='*'||in[i]=='/'))break;
  }
  if(i>=s){
    int a=eval(s,i),b=eval(i+1,t);
    return in[i]=='*'?a*b:a/b;
  }
  if(in[s]=='('&&in[t-1]==')')return eval(s+1,t-1);
  return atoi(in.substr(s,t-s).c_str());
}
int main()
{
  int cs; cin>>cs; cin.ignore();
  rep(i,cs){
    getline(cin,in);
    n=in.size();
    cout<<eval(0,n-1)<<endl;
  }
  return 0;
}

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

int solve(string str){
    vector<int>op;
    vector<char>ope;
    //cout<<"str: "<<str<<endl;
    //cout<<str.length()<<endl;
    for(int i=0;i<str.length();i++){
        //cout<<"KK";
        if(str[i]=='('){
            string t;
            i++;
            while(str[i]!=')'){
                t+=str[i];
                i++;
            }
            i++;
            op.push_back(solve(t));
            //cout<<"(): "<<ope[ope.size()-1]<<endl;
            if(ope.size())
            if(ope[ope.size()-1]=='*'||ope[ope.size()-1]=='/'){
                int a=op[op.size()-1];
                op.pop_back();
                int b=op[op.size()-1];
                op.pop_back();
                if(ope[ope.size()-1]=='*')op.push_back(a*b);
                else op.push_back(b/a);
                ope.pop_back();
            }
            ope.push_back(str[i]);
        }
        else if(str[i]>='0'&&str[i]<='9'){
            int g=0;
            while(str[i]>='0'&&str[i]<='9'){
                g=g*10+str[i]-'0';
                i++;
            }
            op.push_back(g);
            if(ope.size())
                if(ope[ope.size()-1]=='*'||ope[ope.size()-1]=='/'){
                    int a=op[op.size()-1];
                    op.pop_back();
                    int b=op[op.size()-1];
                    op.pop_back();
                    if(ope[ope.size()-1]=='*')op.push_back(a*b);
                    else op.push_back(b/a);
                    ope.pop_back();
                }
            if(str[i])ope.push_back(str[i]);
        }
    }
    //cout<<"!"<<endl;
    int las=op[op.size()-1];
    op.pop_back();
    while(ope.size()){
        //cout<<"las: "<<las<<endl;
        char c=ope[ope.size()-1];
        ope.pop_back();
        if(c=='=')continue;
        int pre=op[op.size()-1];
        //cout<<"pre: "<<pre<<endl;
        //cout<<ope.size()<<"   c: "<<c<<endl;
        op.pop_back();
        if(c=='+')las=las+pre;
        else las=pre-las;
    }
    //cout<<"returned : "<<las<<endl;
    return las;
}

int main(){
    int n;
    cin>>n;
    while(n--){
        string str;
        cin>>str;
        cout<<solve(str)<<endl;
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <stack>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 

int cal(){
  stack<int> st;
  int ope=0;
  int num;
  while(true){
    char c = getchar();
    if(c == '\n' || c == ')' ) break;
    if(c == '(' || ('0'<=c && c<= '9') ) {
      if(c == '(') num = cal();
      else num = (c - '0');
      if(ope==0){
        st.push(num);
      }else if(ope == 1){
        st.push(-num);
        ope = 0;
      }else if(ope == 2){
        int tmp = st.top();
        st.pop();
        st.push(tmp * num);
        ope = 0;
      }else if(ope == 3){
        int tmp = st.top();
        st.pop();
        st.push(tmp / num);
        ope = 0;
      }
    }
    if(c == '+') ope = 0;
    if(c == '-') ope = 1;
    if(c == '*') ope = 2;
    if(c == '/') ope = 3;
  }
  int sum=0;
  while(!st.empty()){
    sum += st.top();
    st.pop();
  }
  return sum;
}

int main(void){  
  int n;
  cin >> n;
  getchar();
  REP(i,n)
    cout << cal() << endl;
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

class Parser {
public:
	using Iter = string::const_iterator;
	Iter it;
	Parser(Iter it) :it(it) {}
	void cmp(char expected) { if (*it != expected)cerr << *it << " is not " << expected << endl; assert(*it == expected); }
	/*
	EBNF
	???=???,{('+'|'-'),???}; //??°???????????????????????¨??????????¨??????§?????????
	???=c,{('*'|'/'),c};
	c ='('???')' | integer;
	*/
	int a() {
		int ret = b();
		while (true) {
			if (*it == '+') {
				it++;
				ret += b();
			}
			else if (*it == '-') {
				it++;
				ret -= b();
			}
			else break;
		}
		return ret;
	}
	int b() {
		int ret = c();
		while (true) {
			if (*it == '*') {
				it++;
				ret *= c();
			}
			else if (*it == '/') {
				it++;
				ret /= c();
			}
			else break;
		}
		return ret;
	}
	int c() {
		int ret;
		if (*it == '(') {
			it++;
			ret = a();
			cmp(')');
			it++;
		}
		else ret = integer();
		return ret;
	}
	int integer() {
		int ret = 0;
		while (isdigit(*it)) {
			ret *= 10;
			ret += *it - '0';
			it++;
		}
		return ret;
	}
};

signed main() {
	int n; cin >> n; cin.ignore();
	for (string s; getline(cin, s) && s != "$"; ) {
		s += "$";
		Parser P(s.begin());
		cout << P.a() << endl;
	}
	return 0;
}