Language: C++

int main() {
	int x;
	cin >> x;
	int d = x % 10;
	int c = (x % 100) / 10;
	int b = (x % 1000) / 100;
	int a = x / 1000;
	if (a + b + c + d == 7) {
		cout << a << "+" << b << "+" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b + c - d == 7) {
		cout << a << "+" << b << "+" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b - c + d == 7) {
		cout << a << "+" << b << "-" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b - c - d == 7) {
		cout << a << "+" << b << "-" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b + c + d == 7) {
		cout << a << "-" << b << "+" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b + c - d == 7) {
		cout << a << "-" << b << "+" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b - c + d == 7) {
		cout << a << "-" << b << "-" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b - c - d == 7) {
		cout << a << "-" << b << "-" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> x;
      |         ^~~
a.cc:9:17: error: 'cout' was not declared in this scope
    9 |                 cout << a << "+" << b << "+" << c << "+" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:9:78: error: 'endl' was not declared in this scope
    9 |                 cout << a << "+" << b << "+" << c << "+" << d << "=" << 7 << endl;
      |                                                                              ^~~~
a.cc:13:17: error: 'cout' was not declared in this scope
   13 |                 cout << a << "+" << b << "+" << c << "-" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:13:78: error: 'endl' was not declared in this scope
   13 |                 cout << a << "+" << b << "+" << c << "-" << d << "=" << 7 << endl;
      |                                                                              ^~~~
a.cc:17:17: error: 'cout' was not declared in this scope
   17 |                 cout << a << "+" << b << "-" << c << "+" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:17:78: error: 'endl' was not declared in this scope
   17 |                 cout << a << "+" << b << "-" << c << "+" << d << "=" << 7 << endl;
      |                                                                              ^~~~
a.cc:21:17: error: 'cout' was not declared in this scope
   21 |                 cout << a << "+" << b << "-" << c << "-" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:21:78: error: 'endl' was not declared in this scope
   21 |                 cout << a << "+" << b << "-" << c << "-" << d << "=" << 7 << endl;
      |                                                                              ^~~~
a.cc:25:17: error: 'cout' was not declared in this scope
   25 |                 cout << a << "-" << b << "+" << c << "+" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:25:78: error: 'endl' was not declared in this scope
   25 |                 cout << a << "-" << b << "+" << c << "+" << d << "=" << 7 << endl;
      |                                                                              ^~~~
a.cc:29:17: error: 'cout' was not declared in this scope
   29 |                 cout << a << "-" << b << "+" << c << "-" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:29:78: error: 'endl' was not declared in this scope
   29 |                 cout << a << "-" << b << "+" << c << "-" << d << "=" << 7 << endl;
      |                                                                              ^~~~
a.cc:33:17: error: 'cout' was not declared in this scope
   33 |                 cout << a << "-" << b << "-" << c << "+" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:33:78: error: 'endl' was not declared in this scope
   33 |                 cout << a << "-" << b << "-" << c << "+" << d << "=" << 7 << endl;
      |                                                                              ^~~~
a.cc:37:17: error: 'cout' was not declared in this scope
   37 |                 cout << a << "-" << b << "-" << c << "-" << d << "=" << 7 << endl;
      |                 ^~~~
a.cc:37:78: error: 'endl' was not declared in this scope
   37 |                 cout << a << "-" << b << "-" << c << "-" << d << "=" << 7 << endl;
      |                                                                              ^~~~