Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,b,c,d,n;
		d=n%10;
		c=(n/10)%10;
		b=(n/100)%10;
		a=n/1000;
		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()':
a.cc:11:75: error: break statement not within loop or switch
   11 |                 if(a+b+c+d==7)cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;break;
      |                                                                           ^~~~~
a.cc:12:17: error: 'else' without a previous 'if'
   12 |                 else if(a+b+c-d==7)cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;break;
      |                 ^~~~
a.cc:12:80: error: break statement not within loop or switch
   12 |                 else if(a+b+c-d==7)cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;break;
      |                                                                                ^~~~~
a.cc:13:17: error: 'else' without a previous 'if'
   13 |                 else if(a+b-c+d==7)cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;break;
      |                 ^~~~
a.cc:13:80: error: break statement not within loop or switch
   13 |                 else if(a+b-c+d==7)cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;break;
      |                                                                                ^~~~~
a.cc:14:17: error: 'else' without a previous 'if'
   14 |                 else if(a+b-c-d==7)cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;break;
      |                 ^~~~
a.cc:14:80: error: break statement not within loop or switch
   14 |                 else if(a+b-c-d==7)cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;break;
      |                                                                                ^~~~~
a.cc:15:17: error: 'else' without a previous 'if'
   15 |                 else if(a-b+c+d==7)cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;break;
      |                 ^~~~
a.cc:15:80: error: break statement not within loop or switch
   15 |                 else if(a-b+c+d==7)cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;break;
      |                                                                                ^~~~~
a.cc:16:17: error: 'else' without a previous 'if'
   16 |                 else if(a-b-c+d==7)cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;break;
      |                 ^~~~
a.cc:16:80: error: break statement not within loop or switch
   16 |                 else if(a-b-c+d==7)cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;break;
      |                                                                                ^~~~~
a.cc:17:17: error: 'else' without a previous 'if'
   17 |                 else if(a-b+c-d==7)cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;break;
      |                 ^~~~
a.cc:17:80: error: break statement not within loop or switch
   17 |                 else if(a-b+c-d==7)cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;break;
      |                                                                                ^~~~~
a.cc:18:17: error: 'else' without a previous 'if'
   18 |                 else if(a-b-c-d==7)cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;break;
      |                 ^~~~
a.cc:18:80: error: break statement not within loop or switch
   18 |                 else if(a-b-c-d==7)cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;break;
      |                                                                                ^~~~~