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 <algorithm>
#include <map>
#include <vector>
#include <functional>
#include <numeric>
using namespace std;
#define rep(p,q) for(int i = p;i < q; i++)
#define big (long long int)(10e9 + 7)

int siki(string &str, int &i);
int kou(string &str, int &i);
int insu(string &str, int &i);
int number(string &str, int &i);

int main(void) {
	int num = 0;
	cin >> num;
	rep(0, num) {
		string str;
		int x = 0;
		cin >> str;
		cout << siki(str, x);
	}
}

int siki(string &str,int &i) {
	int val1 = kou(str,i);
	if (str[i] == '+' || str[i] == '-') {
		char op = str[i];
		i++;
		int val2 = kou(str, i);
		if (op == '+') {
			val1 = val1 + val2;
		}
		else
		{
			val1 = val1 - val2;
		}
	}
	return val1;
}

int kou(string &str, int &i) {
	int val1 = insu(str, i);
	if (str[i] == '*' || str[i] == '/') {
		char op = str[i];
		i++;
		int val2 = insu(str, i);
		if (op == '*') {
			val1 = val1 * val2;
		}
		else {
			val1 = val1 / val2;
		}
	}
	return val1;
}

int insu(string &str, int &i) {
	int val1 = 0;
	if (str[i] == '(') {
		 val1 = siki(str, i);
		i += 2;
	}
	else {
		 val1 = number(str, i);
	}
	return val1;
}

int number(string &str, int &i) {
	int val1 = 0;
	if (str[i] == '0' || str[i] == '1' || str[i] == '2' || str[i] == '3' || str[i] == '4' || str[i] == '5' || str[i] == '6' || str[i] == '7' || str[i] == '8' || str[i] == '9') {
			 val1 = (int)str[i] - (int)'0';
		i++;
		if (str[i] == '0' || str[i] == '1' || str[i] == '2' || str[i] == '3' || str[i] == '4' || str[i] == '5' || str[i] == '6' || str[i] == '7' || str[i] == '8' || str[i] == '9') {
			val1 = val1 * 10;
			val1 += number(str, i);
		}
	}
	return val1;
}

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

#define rep(i,n) for (int i = 0; i < int(n); i++)
typedef long long ll;

int it, n;
string input;

ll expr();
ll term();
ll fact();

ll expr() {
    int v = term();
    while (input[it] == '+' || input[it] == '-') {
        if (input[it++] == '+') {
            v += term();
        } else {
            v -= term();
        }
    }
    return v;
}

ll term() {
    int v = fact();
    while (input[it] == '*' || input[it] == '/') {
        if (input[it++] == '*') {
            v *= term();
        } else {
            v = (int)trunc(1.0*v/term());
            //v /= term();
        }
    }
    return v;
}

ll fact() {
    int v = 0;
    if (input[it] == '(') {
        ++it; // '('
        v = expr();
        ++it; // ')'
    } else {
        int sign = input[it] == '-' ? ++it, -1 : 1;
        while ('0' <= input[it] && input[it] <= '9') {
            v = 10*v + input[it]-'0';
            ++it;
        }
    }
    return v;
}

int main() {
    cin >> n;
    rep (i,n) {
        cin >> input;
        it = 0;
        cout << expr() << endl;
    }
}

C++: #include <iostream>
#include <string>

using namespace std;

int main()
{
string inputting;

cin >> inputting;
cerr << inputting << endl;

return (0);
}

C++: #include<stdio.h>
#include<algorithm>
#include<string>
using namespace std;
char str[200];
pair<int,int>ad(int a);
pair<int,int>mul(int a);
pair<int,int>fact(int a);
pair<int,int>ad(int a){
	pair<int,int> res=mul(a);
	while(str[res.second]=='+'||str[res.second]=='-'){
		pair<int,int>v=mul(res.second+1);
		if(str[res.second]=='+')res.first+=v.first;
		else res.first-=v.first;
		res.second=v.second;
	}
	return res;
}
pair<int,int>mul(int a){
	pair<int,int> res=fact(a);
	while(str[res.second]=='*'||str[res.second]=='/'){
		pair<int,int>v=fact(res.second+1);
		if(str[res.second]=='*')res.first*=v.first;
		else res.first/=v.first;
		res.second=v.second;
	}
	return res;
}
pair<int,int>fact(int a){
	if(str[a]=='('){
		pair<int,int> res=ad(a+1);
		res.second++;
		return res;
	}else{
		int val=0;
		while(isdigit(str[a])){
			val=val*10+str[a++]-'0';
		}
		return make_pair(val,a);
	}
}
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		scanf("%s",str);
		printf("%d\n",ad(0).first);
	}
}

C++: #include<string>
#include<cstdlib>
#include<iostream>

using namespace std;

int prior[128];

int parse(string s)
{
	if(s[0]=='(' && s[s.length()-1]==')'){
		bool f=true;
		for(int i=1,d=1;i<s.length()-1;i++){
			if     (s[i]=='(')	d++;
			else if(s[i]==')')	d--;
			if(d==0){	f=false;	break;	}
		}
		if(f)	return parse(s.substr(1,s.length()-2));
	}

	int divprr=3,divpos=10000000;
	for(int i=s.length()-1,d=0;i>=1;i--){
		if     (s[i]==')')	d--;
		else if(s[i]=='(')	d++;

		else if(d==0 && prior[s[i]]!=0){
			if(divprr>prior[s[i]])
				divprr=prior[s[i]],divpos=i;
		}
	}

	if(divpos==10000000)	return atoi(s.c_str());

	switch(s[divpos]){
		case '+': return parse(s.substr(0,divpos)) + parse(s.substr(divpos+1));
		case '-': return parse(s.substr(0,divpos)) - parse(s.substr(divpos+1));
		case '*': return parse(s.substr(0,divpos)) * parse(s.substr(divpos+1));
		case '/': return parse(s.substr(0,divpos)) / parse(s.substr(divpos+1));
	}

	while(1);
}

int main()
{
	prior['+']=prior['-']=1;
	prior['*']=prior['/']=2;

	int n;	cin>>n;
	while(n--){
		string s;	cin>>s;
		s=s.substr(0,s.length()-1);
		cout<<parse(s)<<endl;
	}

	return 0;
}

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

typedef string::const_iterator Iter;

int expr(Iter &p);
int term(Iter &p);
int factor(Iter &p);
int number(Iter &p);

int expr(Iter &p) {
	int r = term(p);
	for(;;)  {
		if(*p == '+') {
			p++;
			int rs = term(p);
			r += rs;
		}
		else if(*p == '-') {
			p++;
			int rs = term(p);
			r -= rs;
		}
		else
			break;
	}
	return r;
}

int term(Iter &p) {
	int r = factor(p);
	for(;;) {
		if(*p == '*') {
			p++;
			int rs = factor(p);
			r *= rs;
		}
		else if(*p == '/') {
			p++;
			int rs = factor(p);
			r /= rs;
		}
		else
			break;
	}
	return r;
}

int factor(Iter &p) {
	if(*p == '(') {
		p++;
		int r = expr(p);
		p++;
		return r;
	}
	else
		return number(p);
}

int number(Iter &p) {
	int r = 0;
	while(isdigit(*p)) {
		r *= 10;
		r += *p - '0';
		p++;
	}
	return r;
}

int main() {
	int N;
	cin >> N;
	cin.ignore();
	while(N--) {
		string line;
		getline(cin, line);
		line = line += "|";
		Iter begin = line.begin();
		cout << expr(begin) << endl;
	}
}