Language: C++

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

int main() {
  char A,B,C,D;
  cin>>A>>B>>C>>D;
  string ans;
  
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
        int seven=(A-'0');
        string　left;
        left+=(char)seven;
        if(i==0){
          seven+=(B-'0');
          left=left+"+"+(char)(B-'0');
        }
        else{
          seven-=(B-'0');
          left=left+"-"+(char)(B-'0');
        }
        if(j==0){
          seven+=(C-'0');
          left=left+"+"+(char)(C-'0');
        }
        else{
          seven-=(C-'0');
          left=left+"-"+(char)(C-'0');
        }
        if(k==0){
          seven+=(D-'0');
          left=left+"+"+(char)(D-'0');
        }
        else{
          seven-=(D-'0');
          left=left+"-"+(char)(D-'0');
        }
        
        if(seven==7)
          ans=left;
      }
    }
  }
  cout<<ans<<"=7"<<endl;
}


Compiler output:
a.cc:13:9: error: extended character 　 is not valid in an identifier
   13 |         string　left;
      |         ^
a.cc: In function 'int main()':
a.cc:13:9: error: 'string\U00003000left' was not declared in this scope
   13 |         string　left;
      |         ^~~~~~~~~~~~
a.cc:14:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |         left+=(char)seven;
      |         ~~~~^~~~~~~~~~~~~
a.cc:14:13: error: assignment of read-only location 'std::left'
a.cc:17:20: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'const char [2]' to binary 'operator+'
   17 |           left=left+"+"+(char)(B-'0');
      |                ~~~~^~~~
      |                |    |
      |                |    const char [2]
      |                std::ios_base&(std::ios_base&)
a.cc:21:20: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'const char [2]' to binary 'operator+'
   21 |           left=left+"-"+(char)(B-'0');
      |                ~~~~^~~~
      |                |    |
      |                |    const char [2]
      |                std::ios_base&(std::ios_base&)
a.cc:25:20: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'const char [2]' to binary 'operator+'
   25 |           left=left+"+"+(char)(C-'0');
      |                ~~~~^~~~
      |                |    |
      |                |    const char [2]
      |                std::ios_base&(std::ios_base&)
a.cc:29:20: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'const char [2]' to binary 'operator+'
   29 |           left=left+"-"+(char)(C-'0');
      |                ~~~~^~~~
      |                |    |
      |                |    const char [2]
      |                std::ios_base&(std::ios_base&)
a.cc:33:20: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'const char [2]' to binary 'operator+'
   33 |           left=left+"+"+(char)(D-'0');
      |                ~~~~^~~~
      |                |    |
      |                |    const char [2]
      |                std::ios_base&(std::ios_base&)
a.cc:37:20: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'const char [2]' to binary 'operator+'
   37 |           left=left+"-"+(char)(D-'0');
      |                ~~~~^~~~
      |                |    |
      |                |    const char [2]
      |                std::ios_base&(std::ios_base&)
a.cc:41:15: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::ios_base&(std::ios_base&)')
   41 |           ans=left;
      |               ^~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
  840 |       operator=(_CharT __c)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note:   conversion of argument 1 would be ill-formed:
a.cc:41:15: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'char' [-fpermissive]
   41 |           ans=left;
      |               ^~~~
      |               |
      |               std::ios_base& (*)(std::ios_base&)
/usr/include/c++/14/bits/basic_string.h:941:8: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  941 |        operator=(const _Tp& __svt)
      |        ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:941:8: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8:   required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = std::ios_base&(std::ios_base&); _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  149 |         using _If_sv = enable_if_t<
      |               ^~~~~~
/usr/include/c++/14/bits/basic_string.h:941:8:   required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::operator=(const _Tp&) [with _Tp = std::ios_base&(std::ios_base&)]'
  941 |        operator=(const _Tp& __svt)
      |        ^~~~~~~~
a.cc:41:15:   required from here
   41 |           ans=left;
      |               ^~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
 2711 |     using enable_if_t = typename enable_if<_Cond, _Tp>::type;
      |           ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  817 |       operator=(const basic_string& __str)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:817:37: note:   no known conversion for argument 1 from 'std::ios_base&(std::ios_base&)' to 'const std::__cxx11::basic_string<char>&'
  817 |       operator=(const basic_string& __str)
      |                 ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  828 |       operator=(const _CharT* __s)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:31: note:   no known conversion for argument 1 from 'std::ios_base&(std::ios_base&)' to 'const char*'
  828 |       operator=(const _CharT* __s)
      |                 ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  858 |       operator=(basic_string&& __str)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:32: note:   no known conversion for argument 1 from 'std::ios_base&(std::ios_base&)' to 'std::__cxx11::basic_string<char>&&'
  858 |       operator=(basic_string&& __str)
      |                 ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:926:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  926 |       operator=(initializer_list<_CharT> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:926:42: note:   no known conversion for argument 1 from 'std::ios_base&(std::ios_base&)' to 'std::initializer_list<char>'
  926 |       operator=(initializer_list<_CharT> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~