Language: C++

#include<iostream>
#include<cstdlib>
#include<stack>
#include<string>

const int N = 4;
const char *oprs = "+-*";
int operands[N];
int bExist = false;

using namespace std;

int generateExpression(int *oprpos, int *opr, int *operand, int n, int *e){
	int t = 0;
	int eIndex = 0;
	int nextOperand = 0;

	e[eIndex++] = operands[operand[nextOperand++]];
	e[eIndex++] = operands[operand[nextOperand++]];
	for(int i = 0; i < n - 1; i++){
		for(int j = t; j < oprpos[i] + t; j++){
			e[eIndex++] = oprs[opr[j]];
		}
		if( i < n - 2 ){
			e[eIndex++] = operands[operand[nextOperand++]];
		}
		t += oprpos[i];
	}
	return eIndex;
}

int calculateExpression( int *e, int esize, string &answer ){
	int i = 0;
	stack< int > st;
	stack< string > sst;
	int ret = 0;

	for(int i = 0; i < esize; i++){
		int t, t1, t2;
		string exp, exp1, exp2;
		char opr;
		opr = e[i];

		if( opr == '+' || opr == '-' || opr == '*' ){
			exp1 = sst.top();	sst.pop();
			exp2 = sst.top();	sst.pop();
			switch( opr ){
				case '+':
					t1 = st.top();	st.pop();
					t2 = st.top();	st.pop();
					t = t1 + t2;
					st.push( t );
					break;
				case '-':
					t2 = st.top();	st.pop();
					t1 = st.top();	st.pop();
					swap( exp1, exp2 );
					t = t1 - t2;
					st.push( t );
					break;
				case '*':
					t1 = st.top();	st.pop();
					t2 = st.top();	st.pop();
					t = t1 * t2;
					st.push( t );
					break;
			}
			exp = '(';exp+=exp1;exp+=' ';exp+=opr;exp+=' ';exp+=exp2;exp+=')';
			sst.push( exp );
		}else{
			char stroperand[32];
			_itoa( opr, stroperand, 10 );
			st.push( opr );
			sst.push( stroperand );
		}
	}
	ret = st.top();
	answer = sst.top();
	return ret;
}

void permit_operand(int *flag, int *p, int rest, int n, int *opr, int *oprpos){
	int t = 0;
	for(int i = 0; i < n; i++ ){
		if( flag[i] ){
			t++;
		}
	}
	if( t == n ){
		// TODO
		int e[N*2], esize;
		string expr;

		esize = generateExpression( oprpos, opr, p, n, e);
		if( calculateExpression( e, esize, expr ) == 10 ){
			if( !bExist ){
				bExist = true;
				cout << expr << '\n';
			}
		}
		return ;
	}

	for(int i = 0; i < n; i++ ){
		if( flag[i] ){
			continue;
		}else{
			flag[i] = 1;
			p[n - rest] = i;
			permit_operand(flag, p, rest - 1, n, opr, oprpos);
			flag[i] = 0;
		}
	}
}

void rawcomb_opr(int *p, int rest, int n, int *oprpos){
	if( rest == 0 ){
		// TODO
		int flag[N] = {0,};
		int operand[N];
		permit_operand( flag, operand, N, N, p, oprpos );
		return ;
	}
	for(int i = 0; i < n; i++){
		p[n - rest] = i;
		rawcomb_opr(p, rest - 1, n, oprpos);
	}
}

void rawcomb_oprpos(int *p, int rest, int n){
	if( rest == 0 ){
		// TODO
		int t = 0;
		for(int m = 0; m < n - 1; m++){
			t += p[m];
			if( t > m + 1 ){
				return ;
			}
		}
		if( t == n - 1 ){
			int opr[N];
			rawcomb_opr( opr, 3, 3, p );
		}
		return ;
	}
	for(int i = 0; i < n + 1 - rest; i++){
		p[(n - 1) - rest] = i;
		rawcomb_oprpos(p, rest - 1, n);
	}
}

int main(void){
	while(true){
		int end = 0;
		int p[N];

		for(int i = 0; i < N; i++){
			cin>>operands[i];
			end |= operands[i];
		}
		if( end == 0 ){
			break;
		}
		bExist = false;
		rawcomb_oprpos(p, N - 1, N);
		if( !bExist ){
			cout << "0\n";
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int calculateExpression(int*, int, std::string&)':
a.cc:72:25: error: '_itoa' was not declared in this scope
   72 |                         _itoa( opr, stroperand, 10 );
      |                         ^~~~~