Language: C++

#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(i=0;i<n;i++) int main(){ int a[4],p[4]={0},i;
char x[10];
cin>>x;
 rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }

Compiler output:
a.cc:1:25: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h> using namespace std; #define rep(i,n) for(i=0;i<n;i++) int main(){ int a[4],p[4]={0},i;
      |                         ^~~~~
a.cc:3:1: error: 'cin' does not name a type
    3 | cin>>x;
      | ^~~
a.cc:4:5: error: expected constructor, destructor, or type conversion before '(' token
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |     ^
a.cc:4:27: error: expected unqualified-id before 'if'
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                           ^~
a.cc:4:112: error: expected unqualified-id before 'if'
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                                                                                                                ^~
a.cc:4:197: error: expected unqualified-id before 'if'
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                                                                                                                                                                                                     ^~
a.cc:4:282: error: expected unqualified-id before 'if'
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                                                                                                                                                                                                                                                                                          ^~
a.cc:4:367: error: expected unqualified-id before 'if'
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                                                                                                                                                                                                                                                                                                                                                                               ^~
a.cc:4:452: error: expected unqualified-id before 'if'
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^~
a.cc:4:537: error: expected unqualified-id before 'if'
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ^~
a.cc:4:622: error: expected declaration before '}' token
    4 |  rep(i,4){a[i]=x[i]-'0';} if(a[0]+a[1]+a[2]+a[3]==7){ printf("%d+%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]+a[3]==7){ printf("%d-%d+%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]+a[3]==7){ printf("%d+%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]+a[2]-a[3]==7){ printf("%d+%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]+a[1]-a[2]-a[3]==7){ printf("%d+%d-%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]+a[2]-a[3]==7){ printf("%d-%d+%d-%d=7",a[0],a[1],a[2],a[3]); return 0; } if(a[0]-a[1]-a[2]+a[3]==7){ printf("%d-%d-%d+%d=7",a[0],a[1],a[2],a[3]); return 0; } }
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ^