Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int S,A,B,C,D;
  cin>>S;
  A=S/1000,B=S/100%10,C=S/10%10,D=S%10
  char op1,op2,op3;
  if(A+B+C<7)if(A+B+C+D==7)op1='+',op2='+',op3='+';
  else if(A+B+C-D==7)op1='+',op2='+',op3='-';
  if(A+B-C<7)if(A+B-C+D==7)op1='+',op2='-',op3='+';
  else if(A+B-C-D==7)op1='+',op2='-',op3='-';
  if(A-B+C<7)if(A-B+C+D==7)op1='-',op2='+',op3='+';
  else if(A-B+C-D==7)op1='-',op2='+',op3='-';
  if(A-B-C<7)if(A-B-C+D==7)op1='-',op2='-',op3='+';
  else if(A-B-C-D==7)op1='-',op2='-',op3='-';
  cout<<A<<op1<<B<<op2<<C<<op3<<D<<"=7"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:39: error: expected ';' before 'char'
    6 |   A=S/1000,B=S/100%10,C=S/10%10,D=S%10
      |                                       ^
      |                                       ;
    7 |   char op1,op2,op3;
      |   ~~~~                                 
a.cc:8:28: error: 'op1' was not declared in this scope
    8 |   if(A+B+C<7)if(A+B+C+D==7)op1='+',op2='+',op3='+';
      |                            ^~~
a.cc:8:36: error: 'op2' was not declared in this scope
    8 |   if(A+B+C<7)if(A+B+C+D==7)op1='+',op2='+',op3='+';
      |                                    ^~~
a.cc:8:44: error: 'op3' was not declared in this scope
    8 |   if(A+B+C<7)if(A+B+C+D==7)op1='+',op2='+',op3='+';
      |                                            ^~~
a.cc:9:22: error: 'op1' was not declared in this scope
    9 |   else if(A+B+C-D==7)op1='+',op2='+',op3='-';
      |                      ^~~
a.cc:9:30: error: 'op2' was not declared in this scope
    9 |   else if(A+B+C-D==7)op1='+',op2='+',op3='-';
      |                              ^~~
a.cc:9:38: error: 'op3' was not declared in this scope
    9 |   else if(A+B+C-D==7)op1='+',op2='+',op3='-';
      |                                      ^~~
a.cc:10:28: error: 'op1' was not declared in this scope
   10 |   if(A+B-C<7)if(A+B-C+D==7)op1='+',op2='-',op3='+';
      |                            ^~~
a.cc:10:36: error: 'op2' was not declared in this scope
   10 |   if(A+B-C<7)if(A+B-C+D==7)op1='+',op2='-',op3='+';
      |                                    ^~~
a.cc:10:44: error: 'op3' was not declared in this scope
   10 |   if(A+B-C<7)if(A+B-C+D==7)op1='+',op2='-',op3='+';
      |                                            ^~~
a.cc:11:22: error: 'op1' was not declared in this scope
   11 |   else if(A+B-C-D==7)op1='+',op2='-',op3='-';
      |                      ^~~
a.cc:11:30: error: 'op2' was not declared in this scope
   11 |   else if(A+B-C-D==7)op1='+',op2='-',op3='-';
      |                              ^~~
a.cc:11:38: error: 'op3' was not declared in this scope
   11 |   else if(A+B-C-D==7)op1='+',op2='-',op3='-';
      |                                      ^~~
a.cc:12:28: error: 'op1' was not declared in this scope
   12 |   if(A-B+C<7)if(A-B+C+D==7)op1='-',op2='+',op3='+';
      |                            ^~~
a.cc:12:36: error: 'op2' was not declared in this scope
   12 |   if(A-B+C<7)if(A-B+C+D==7)op1='-',op2='+',op3='+';
      |                                    ^~~
a.cc:12:44: error: 'op3' was not declared in this scope
   12 |   if(A-B+C<7)if(A-B+C+D==7)op1='-',op2='+',op3='+';
      |                                            ^~~
a.cc:13:22: error: 'op1' was not declared in this scope
   13 |   else if(A-B+C-D==7)op1='-',op2='+',op3='-';
      |                      ^~~
a.cc:13:30: error: 'op2' was not declared in this scope
   13 |   else if(A-B+C-D==7)op1='-',op2='+',op3='-';
      |                              ^~~
a.cc:13:38: error: 'op3' was not declared in this scope
   13 |   else if(A-B+C-D==7)op1='-',op2='+',op3='-';
      |                                      ^~~
a.cc:14:28: error: 'op1' was not declared in this scope
   14 |   if(A-B-C<7)if(A-B-C+D==7)op1='-',op2='-',op3='+';
      |                            ^~~
a.cc:14:36: error: 'op2' was not declared in this scope
   14 |   if(A-B-C<7)if(A-B-C+D==7)op1='-',op2='-',op3='+';
      |                                    ^~~
a.cc:14:44: error: 'op3' was not declared in this scope
   14 |   if(A-B-C<7)if(A-B-C+D==7)op1='-',op2='-',op3='+';
      |                                            ^~~
a.cc:15:22: error: 'op1' was not declared in this scope
   15 |   else if(A-B-C-D==7)op1='-',op2='-',op3='-';
      |                      ^~~
a.cc:15:30: error: 'op2' was not declared in this scope
   15 |   else if(A-B-C-D==7)op1='-',op2='-',op3='-';
      |                              ^~~
a.cc:15:38: error: 'op3' was not declared in this scope
   15 |   else if(A-B-C-D==7)op1='-',op2='-',op3='-';
      |                                      ^~~
a.cc:16:12: error: 'op1' was not declared in this scope
   16 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<<"=7"<<endl;
      |            ^~~
a.cc:16:20: error: 'op2' was not declared in this scope
   16 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<<"=7"<<endl;
      |                    ^~~
a.cc:16:28: error: 'op3' was not declared in this scope
   16 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<<"=7"<<endl;
      |                            ^~~