Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(void){
	std::string s[4];
  	cin >> string;
  	int a,b,c,d,i,sum;
  	char c1,c2,c3;
  	a = stoi(s.substr(0,1));
  	b = stoi(s.substr(1,1));
  	c = stoi(s.substr(2,1));
  	d = stoi(s.substr(3,1));
  	for (i=0;i<8,i++){
    	sum = a + (int)(pow(-1,i))*b + (int)(pow(-1,i%2))*c + (int)(pow(-1,i%3)*d;
        if (sum==7){
        	if((int)(pow(-1,i))*b == 1){
            	c1 = "+";
            }else{
            	c1 = "-";
            }
          	if((int)(pow(-1,i%2))*c == 1){
            	c2 = "+";
            }else{
            	c2 = "-";
            }
          	if((int)(pow(-1,i))*d == 1){
            	c3 = "+";
            }else{
            	c3 = "-";
            }
          	cout << a << c1 << b << c2 << c << c3 << d ;
          	return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected primary-expression before ';' token
    8 |         cin >> string;
      |                      ^
a.cc:11:20: error: request for member 'substr' in 's', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
   11 |         a = stoi(s.substr(0,1));
      |                    ^~~~~~
a.cc:12:20: error: request for member 'substr' in 's', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
   12 |         b = stoi(s.substr(1,1));
      |                    ^~~~~~
a.cc:13:20: error: request for member 'substr' in 's', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
   13 |         c = stoi(s.substr(2,1));
      |                    ^~~~~~
a.cc:14:20: error: request for member 'substr' in 's', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
   14 |         d = stoi(s.substr(3,1));
      |                    ^~~~~~
a.cc:15:25: error: expected ';' before ')' token
   15 |         for (i=0;i<8,i++){
      |                         ^
      |                         ;
a.cc:16:82: error: expected ')' before ';' token
   16 |         sum = a + (int)(pow(-1,i))*b + (int)(pow(-1,i%2))*c + (int)(pow(-1,i%3)*d;
      |                                                                    ~             ^
      |                                                                                  )
a.cc:19:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   19 |                 c1 = "+";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:21:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   21 |                 c1 = "-";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:24:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   24 |                 c2 = "+";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:26:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   26 |                 c2 = "-";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:29:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   29 |                 c3 = "+";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:31:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   31 |                 c3 = "-";
      |                      ^~~
      |                      |
      |                      const char*