Language: C++

int main(int argc, const char * argv[])
{
    int a,b,c,d;
    int n;
    cin >> n;
    a = n/1000;
    b = (n - a*1000)/100;
    c = (n - a*1000-b*100)/10;
    d = n%10;
    while(1)
    {
        if( a+b+c+d == 7){
            cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
            break;
        }
        else if( a+b+c-d == 7){
            cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
            break;
        }
        else if( a+b-c+d == 7){
            cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
            break;
        }
        else if( a+b-c-d == 7){
            cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
            break;
        }
        else if( a-b+c+d == 7){
            cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
            break;
        }
        else if( a-b+c-d == 7){
            cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
            break;
        }
        else if( a-b-c+d == 7){
            cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
            break;
        }
        else if( a-b-c-d == 7){
            cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
            break;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> n;
      |     ^~~
a.cc:13:13: error: 'cout' was not declared in this scope
   13 |             cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
      |             ^~~~
a.cc:13:70: error: 'endl' was not declared in this scope
   13 |             cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
      |                                                                      ^~~~
a.cc:17:13: error: 'cout' was not declared in this scope
   17 |             cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
      |             ^~~~
a.cc:17:70: error: 'endl' was not declared in this scope
   17 |             cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
      |                                                                      ^~~~
a.cc:21:13: error: 'cout' was not declared in this scope
   21 |             cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
      |             ^~~~
a.cc:21:70: error: 'endl' was not declared in this scope
   21 |             cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
      |                                                                      ^~~~
a.cc:25:13: error: 'cout' was not declared in this scope
   25 |             cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
      |             ^~~~
a.cc:25:70: error: 'endl' was not declared in this scope
   25 |             cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
      |                                                                      ^~~~
a.cc:29:13: error: 'cout' was not declared in this scope
   29 |             cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
      |             ^~~~
a.cc:29:70: error: 'endl' was not declared in this scope
   29 |             cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
      |                                                                      ^~~~
a.cc:33:13: error: 'cout' was not declared in this scope
   33 |             cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
      |             ^~~~
a.cc:33:70: error: 'endl' was not declared in this scope
   33 |             cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
      |                                                                      ^~~~
a.cc:37:13: error: 'cout' was not declared in this scope
   37 |             cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
      |             ^~~~
a.cc:37:70: error: 'endl' was not declared in this scope
   37 |             cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
      |                                                                      ^~~~
a.cc:41:13: error: 'cout' was not declared in this scope
   41 |             cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
      |             ^~~~
a.cc:41:70: error: 'endl' was not declared in this scope
   41 |             cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
      |                                                                      ^~~~