Language: C++

#include<iostream>
#include<queue>
#include<set>
#include<string>
#include<map>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b,c,d;
string s;
int main()
{
	cin>>s;
	a=s[0]-"0";
	b=s[1]-"0";
	c=s[2]-"0";
	d=s[3]-"0";
	if(a+b+c+d==7)
	{
		cout<<a+b+c+d=7;
	}
	if(a+b+c-d==7)
	{
		cout<<a+b+c-d=7;
	}
	if(a+b-c+d==7)
	{
		cout<<a<<+b-c+d=7;
	}
	if(a-b+c+d==7)
	{
		cout<<a<<-b+c+d=7;
	}
	if(a+b-c-d==7)
	{
		cout<<a+b-c-d=7;
	}
	if(a-b+c-d==7)
	{
		cout<<a-b+c-d=7;
	}
	if(a-b-c+d==7)
	{
		cout<<a-b-c+d=7;
	}
	if(a-b-c-d==7)
	{
		cout<<a-b-c-d=7;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   15 |         a=s[0]-"0";
a.cc:16:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   16 |         b=s[1]-"0";
a.cc:17:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   17 |         c=s[2]-"0";
a.cc:18:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   18 |         d=s[3]-"0";
a.cc:21:31: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   21 |                 cout<<a+b+c+d=7;
      |                               ^
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:25:31: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   25 |                 cout<<a+b+c-d=7;
      |                               ^
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:29:33: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   29 |                 cout<<a<<+b-c+d=7;
      |                                 ^
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:33:33: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   33 |                 cout<<a<<-b+c+d=7;
      |                                 ^
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:37:31: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   37 |                 cout<<a+b-c-d=7;
      |                               ^
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:41:31: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   41 |                 cout<<a-b+c-d=7;
      |                               ^
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:45:31: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   45 |                 cout<<a-b-c+d=7;
      |                               ^
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:49:31: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
   49 |                 cout<<a-b-c-d=7;
      |                               ^
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~