Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  if(n[0]+n[1]+n[2]+n[3]==7){
    cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
    
  }else if(n[0]+n[1]+n[2]-n[3]==7){
    cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
    
  }else if(n[0]+n[1]-n[2]+n[3]==7){
    cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
    
  }else if(n[0]+n[1]-n[2]-n[3]==7){
    cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
    
  }else if(n[0]-n[1]+n[2]+n[3]==7){
    cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
    
  }else if(n[0]-n[1]+n[2]-n[3]==7){
    cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
    
  }else if(n[0]-n[1]-n[2]+n[3]==7){
    cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
    
  }else if(n[0]-n[1]-n[2]-n[3]==7){
    cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: invalid types 'int[int]' for array subscript
    7 |   if(n[0]+n[1]+n[2]+n[3]==7){
      |       ^
a.cc:7:12: error: invalid types 'int[int]' for array subscript
    7 |   if(n[0]+n[1]+n[2]+n[3]==7){
      |            ^
a.cc:7:17: error: invalid types 'int[int]' for array subscript
    7 |   if(n[0]+n[1]+n[2]+n[3]==7){
      |                 ^
a.cc:7:22: error: invalid types 'int[int]' for array subscript
    7 |   if(n[0]+n[1]+n[2]+n[3]==7){
      |                      ^
a.cc:8:12: error: invalid types 'int[int]' for array subscript
    8 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:8:23: error: invalid types 'int[int]' for array subscript
    8 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:8:34: error: invalid types 'int[int]' for array subscript
    8 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:8:45: error: invalid types 'int[int]' for array subscript
    8 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                             ^
a.cc:10:13: error: invalid types 'int[int]' for array subscript
   10 |   }else if(n[0]+n[1]+n[2]-n[3]==7){
      |             ^
a.cc:10:18: error: invalid types 'int[int]' for array subscript
   10 |   }else if(n[0]+n[1]+n[2]-n[3]==7){
      |                  ^
a.cc:10:23: error: invalid types 'int[int]' for array subscript
   10 |   }else if(n[0]+n[1]+n[2]-n[3]==7){
      |                       ^
a.cc:10:28: error: invalid types 'int[int]' for array subscript
   10 |   }else if(n[0]+n[1]+n[2]-n[3]==7){
      |                            ^
a.cc:11:12: error: invalid types 'int[int]' for array subscript
   11 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:11:23: error: invalid types 'int[int]' for array subscript
   11 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:11:34: error: invalid types 'int[int]' for array subscript
   11 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:11:45: error: invalid types 'int[int]' for array subscript
   11 |     cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                             ^
a.cc:13:13: error: invalid types 'int[int]' for array subscript
   13 |   }else if(n[0]+n[1]-n[2]+n[3]==7){
      |             ^
a.cc:13:18: error: invalid types 'int[int]' for array subscript
   13 |   }else if(n[0]+n[1]-n[2]+n[3]==7){
      |                  ^
a.cc:13:23: error: invalid types 'int[int]' for array subscript
   13 |   }else if(n[0]+n[1]-n[2]+n[3]==7){
      |                       ^
a.cc:13:28: error: invalid types 'int[int]' for array subscript
   13 |   }else if(n[0]+n[1]-n[2]+n[3]==7){
      |                            ^
a.cc:14:12: error: invalid types 'int[int]' for array subscript
   14 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:14:23: error: invalid types 'int[int]' for array subscript
   14 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:14:34: error: invalid types 'int[int]' for array subscript
   14 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:14:45: error: invalid types 'int[int]' for array subscript
   14 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                             ^
a.cc:16:13: error: invalid types 'int[int]' for array subscript
   16 |   }else if(n[0]+n[1]-n[2]-n[3]==7){
      |             ^
a.cc:16:18: error: invalid types 'int[int]' for array subscript
   16 |   }else if(n[0]+n[1]-n[2]-n[3]==7){
      |                  ^
a.cc:16:23: error: invalid types 'int[int]' for array subscript
   16 |   }else if(n[0]+n[1]-n[2]-n[3]==7){
      |                       ^
a.cc:16:28: error: invalid types 'int[int]' for array subscript
   16 |   }else if(n[0]+n[1]-n[2]-n[3]==7){
      |                            ^
a.cc:17:12: error: invalid types 'int[int]' for array subscript
   17 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:17:23: error: invalid types 'int[int]' for array subscript
   17 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:17:34: error: invalid types 'int[int]' for array subscript
   17 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:17:45: error: invalid types 'int[int]' for array subscript
   17 |     cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                             ^
a.cc:19:13: error: invalid types 'int[int]' for array subscript
   19 |   }else if(n[0]-n[1]+n[2]+n[3]==7){
      |             ^
a.cc:19:18: error: invalid types 'int[int]' for array subscript
   19 |   }else if(n[0]-n[1]+n[2]+n[3]==7){
      |                  ^
a.cc:19:23: error: invalid types 'int[int]' for array subscript
   19 |   }else if(n[0]-n[1]+n[2]+n[3]==7){
      |                       ^
a.cc:19:28: error: invalid types 'int[int]' for array subscript
   19 |   }else if(n[0]-n[1]+n[2]+n[3]==7){
      |                            ^
a.cc:20:12: error: invalid types 'int[int]' for array subscript
   20 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:20:23: error: invalid types 'int[int]' for array subscript
   20 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:20:34: error: invalid types 'int[int]' for array subscript
   20 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:20:45: error: invalid types 'int[int]' for array subscript
   20 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                             ^
a.cc:22:13: error: invalid types 'int[int]' for array subscript
   22 |   }else if(n[0]-n[1]+n[2]-n[3]==7){
      |             ^
a.cc:22:18: error: invalid types 'int[int]' for array subscript
   22 |   }else if(n[0]-n[1]+n[2]-n[3]==7){
      |                  ^
a.cc:22:23: error: invalid types 'int[int]' for array subscript
   22 |   }else if(n[0]-n[1]+n[2]-n[3]==7){
      |                       ^
a.cc:22:28: error: invalid types 'int[int]' for array subscript
   22 |   }else if(n[0]-n[1]+n[2]-n[3]==7){
      |                            ^
a.cc:23:12: error: invalid types 'int[int]' for array subscript
   23 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:23:23: error: invalid types 'int[int]' for array subscript
   23 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:23:34: error: invalid types 'int[int]' for array subscript
   23 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:23:45: error: invalid types 'int[int]' for array subscript
   23 |     cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                             ^
a.cc:25:13: error: invalid types 'int[int]' for array subscript
   25 |   }else if(n[0]-n[1]-n[2]+n[3]==7){
      |             ^
a.cc:25:18: error: invalid types 'int[int]' for array subscript
   25 |   }else if(n[0]-n[1]-n[2]+n[3]==7){
      |                  ^
a.cc:25:23: error: invalid types 'int[int]' for array subscript
   25 |   }else if(n[0]-n[1]-n[2]+n[3]==7){
      |                       ^
a.cc:25:28: error: invalid types 'int[int]' for array subscript
   25 |   }else if(n[0]-n[1]-n[2]+n[3]==7){
      |                            ^
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:26:23: error: invalid types 'int[int]' for array subscript
   26 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:26:34: error: invalid types 'int[int]' for array subscript
   26 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:26:45: error: invalid types 'int[int]' for array subscript
   26 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
      |                                             ^
a.cc:28:13: error: invalid types 'int[int]' for array subscript
   28 |   }else if(n[0]-n[1]-n[2]-n[3]==7){
      |             ^
a.cc:28:18: error: invalid types 'int[int]' for array subscript
   28 |   }else if(n[0]-n[1]-n[2]-n[3]==7){
      |                  ^
a.cc:28:23: error: invalid types 'int[int]' for array subscript
   28 |   }else if(n[0]-n[1]-n[2]-n[3]==7){
      |                       ^
a.cc:28:28: error: invalid types 'int[int]' for array subscript
   28 |   }else if(n[0]-n[1]-n[2]-n[3]==7){
      |                            ^
a.cc:29:12: error: invalid types 'int[int]' for array subscript
   29 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |            ^
a.cc:29:23: error: invalid types 'int[int]' for array subscript
   29 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                       ^
a.cc:29:34: error: invalid types 'int[int]' for array subscript
   29 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                  ^
a.cc:29:45: error: invalid types 'int[int]' for array subscript
   29 |     cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
      |                                             ^