Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- void more() { std::cout << "More than ZERO!\n"; }
- void less() { std::cout << "Less than ZERO!\n"; }
- void zero() { std::cout << "ZERO!\n"; }
- void funVal(int val) { std::cout << "FunVal statred! val = " << val << '\n'; }
- void funVal1(int val) { std::cout << "FunVal1 statred! val = " << val << '\n'; }
- int max(int a, int b) { return a > b ? a : b; };
- int min(int a, int b) { return a < b ? a : b; };
- int main()
- {
- void(*numFun)() { nullptr };
- int num{};
- std::cout << "Enter number: ";
- std::cin >> num;
- //if (num == 0) { numFun = zero; };
- if (num > 0) { numFun = more; };
- if (num < 0) { numFun = less; };
- if (numFun) { numFun(); }
- else { std::cout << "numFun == nullptr!!!\n"; };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement