- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
#include <iostream>
using namespace std;
class Boolean {
public:
Boolean() : m_flag(false), m_val(0) {}
Boolean(bool flag) : m_flag(flag), m_val(0) {}
Boolean(bool flag, int val) : m_flag(flag), m_val(val) {}
Boolean operator || (int val) {
return Boolean(m_flag || val == m_val, m_val);
}
operator bool() { return m_flag; }
private:
bool m_flag;
int m_val;
};
class Integer {
public:
Integer() : m_val(0) {}
Integer(int val) : m_val(val) {}
operator int() { return m_val; }
Boolean operator == (int val) { return Boolean(val == m_val, m_val); }
Boolean operator == (const Integer & val) { return Boolean(val.m_val == m_val, m_val); }
private:
int m_val;
};
int main() {
Integer a(10);
cout << bool(a == 15 || 10) << endl;
cout << bool(a == 15 || 11) << endl;
cout << bool(a == 15 || 11 || 13 || 11 || 0 || 10 || 5) << endl;
cout << bool(a == 15 || 11 || 13 || 11 || 0 || 9 || 5) << endl;
return 0;
}
Dummy00001 07.07.2016 14:22 # +2
Antervis 07.07.2016 16:27 # 0
Soul_re@ver 07.07.2016 16:30 # +1
TarasB 07.07.2016 16:36 # +3
inkanus-gray 07.07.2016 17:08 # +3
kurwa-nextgen 07.07.2016 17:20 # +3
inkanus-gray 07.07.2016 17:25 # +7
3_14dar 07.07.2016 17:54 # 0
inkanus-gray 07.07.2016 23:38 # +2
CHayT 07.07.2016 23:44 # 0
3_14dar 07.07.2016 23:59 # +1
3_14dar 07.07.2016 23:59 # 0
guestinho 07.07.2016 17:56 # +2
guestinho 07.07.2016 17:27 # +3
j123123 08.07.2016 00:10 # +1
Bobik 07.07.2016 23:30 # 0
Wyrap_nJll-oM_qpaupu 25.08.2021 21:16 # 0