Language: C++

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

int main(){
  string n;
  cin>>n;
  vector<string>str(4);
  for(int i=0;i<4;i++)str[i]=n.at(i);
  vector<int>num(4);
  for(int i=0;i<4;i++)num[i]=stoi(str[i]);
  int a=num[0];
  int b=num[1];
  int c=num[2];
  int d=num[3];
  if(a+b+c+d==7)cout<<a+"+"+b+"+"+c+"+"+d+"=7"<<endl;
  else if(a+b+c-d==7)cout<<a+"+"+b+"+"+c+"-"+d+"=7"<<endl;
  else if(a+b-c+d==7)cout<<a+"+"+b+"-"+c+"+"+d+"=7"<<endl;
  else if(a+b-c-d==7)cout<<a+"+"+b+"-"+c+"-"+d+"=7"<<endl;
  else if(a-b+c+d==7)cout<<a+"-"+b+"+"+c+"+"+d+"=7"<<endl;
  else if(a-b+c-d==7)cout<<a+"-"+b+"+"+c+"-"+d+"=7"<<endl;
  else if(a-b-c+d==7)cout<<a+"-"+b+"-"+c+"+"+d+"=7"<<endl;
  else if(a-b-c-d==7)cout<<a+"-"+b+"-"+c+"-"+d+"=7"<<endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:15:30: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   15 |   if(a+b+c+d==7)cout<<a+"+"+b+"+"+c+"+"+d+"=7"<<endl;
      |                       ~~~~~~~^~~~
      |                            |  |
      |                            |  const char [2]
      |                            const char*
a.cc:16:35: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   16 |   else if(a+b+c-d==7)cout<<a+"+"+b+"+"+c+"-"+d+"=7"<<endl;
      |                            ~~~~~~~^~~~
      |                                 |  |
      |                                 |  const char [2]
      |                                 const char*
a.cc:17:35: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   17 |   else if(a+b-c+d==7)cout<<a+"+"+b+"-"+c+"+"+d+"=7"<<endl;
      |                            ~~~~~~~^~~~
      |                                 |  |
      |                                 |  const char [2]
      |                                 const char*
a.cc:18:35: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   18 |   else if(a+b-c-d==7)cout<<a+"+"+b+"-"+c+"-"+d+"=7"<<endl;
      |                            ~~~~~~~^~~~
      |                                 |  |
      |                                 |  const char [2]
      |                                 const char*
a.cc:19:35: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   19 |   else if(a-b+c+d==7)cout<<a+"-"+b+"+"+c+"+"+d+"=7"<<endl;
      |                            ~~~~~~~^~~~
      |                                 |  |
      |                                 |  const char [2]
      |                                 const char*
a.cc:20:35: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   20 |   else if(a-b+c-d==7)cout<<a+"-"+b+"+"+c+"-"+d+"=7"<<endl;
      |                            ~~~~~~~^~~~
      |                                 |  |
      |                                 |  const char [2]
      |                                 const char*
a.cc:21:35: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   21 |   else if(a-b-c+d==7)cout<<a+"-"+b+"-"+c+"+"+d+"=7"<<endl;
      |                            ~~~~~~~^~~~
      |                                 |  |
      |                                 |  const char [2]
      |                                 const char*
a.cc:22:35: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   22 |   else if(a-b-c-d==7)cout<<a+"-"+b+"-"+c+"-"+d+"=7"<<endl;
      |                            ~~~~~~~^~~~
      |                                 |  |
      |                                 |  const char [2]
      |                                 const char*