Language: C++


#include <iostream>
#include <cmath>
using namespace std;

int main() {
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> k;
  int answer = 0;
  int hantei = abs(a-b);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(a-c);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(a-d);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(a-e);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(b-c);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(b-d);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(b-e);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(c-d);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(c-e);
  if (hantei > k){
     answer = 1;
  }
  int hantei = abs(d-e);
  if (hantei > k){
     answer = 1;
  }
  if(answer = 1){
  cout << ":(" << endl;
  }else{
    cout << "Yey!"endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'a' was not declared in this scope
    7 |   cin >> a;
      |          ^
a.cc:8:10: error: 'b' was not declared in this scope
    8 |   cin >> b;
      |          ^
a.cc:9:10: error: 'c' was not declared in this scope
    9 |   cin >> c;
      |          ^
a.cc:10:10: error: 'd' was not declared in this scope
   10 |   cin >> d;
      |          ^
a.cc:11:10: error: 'e' was not declared in this scope
   11 |   cin >> e;
      |          ^
a.cc:12:10: error: 'k' was not declared in this scope
   12 |   cin >> k;
      |          ^
a.cc:18:7: error: redeclaration of 'int hantei'
   18 |   int hantei = abs(a-c);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:22:7: error: redeclaration of 'int hantei'
   22 |   int hantei = abs(a-d);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:26:7: error: redeclaration of 'int hantei'
   26 |   int hantei = abs(a-e);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:30:7: error: redeclaration of 'int hantei'
   30 |   int hantei = abs(b-c);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:34:7: error: redeclaration of 'int hantei'
   34 |   int hantei = abs(b-d);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:38:7: error: redeclaration of 'int hantei'
   38 |   int hantei = abs(b-e);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:42:7: error: redeclaration of 'int hantei'
   42 |   int hantei = abs(c-d);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:46:7: error: redeclaration of 'int hantei'
   46 |   int hantei = abs(c-e);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:50:7: error: redeclaration of 'int hantei'
   50 |   int hantei = abs(d-e);
      |       ^~~~~~
a.cc:14:7: note: 'int hantei' previously declared here
   14 |   int hantei = abs(a-b);
      |       ^~~~~~
a.cc:57:13: error: unable to find string literal operator 'operator""endl' with 'const char [5]', 'long unsigned int' arguments
   57 |     cout << "Yey!"endl;
      |             ^~~~~~~~~~