Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class Divine
- {
- std::int64_t _a;
- std::int64_t _b;
- static int RetardedModulo(int a, int b)
- {
- if (b < a)
- {
- a = a + b;
- b = a - b;
- a = a - b;
- }
- while (b >= a) { b -= a; }
- return b;
- }
- public:
- Divine() = default;
- Divine(int a, int b) :
- _a{ a },
- _b{ b }{}
- static bool CanBeDivined(Divine&& object, bool(*DiviningFunc)(bool))
- {
- if (RetardedModulo(object._a, object._b) == 0)
- {
- return DiviningFunc(true) ? true : false;
- }
- else if (RetardedModulo(object._a, object._b) != 0)
- {
- return DiviningFunc(false) ? true : false;
- }
- else
- {
- return DiviningFunc(false) ? true : false;
- }
- }
- };
- int main()
- {
- constexpr int a{ 10 };
- constexpr int b{ 2 };
- bool temporary=Divine().CanBeDivined(Divine(a, b),
- [](bool result)
- {
- return result;
- });
- if (temporary)
- {
- std::cout << "Can be divined\n";
- }
- else
- {
- std::cout << "Can not be divined\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment