- Hey everyone, so I have a few challenges for you and all of them are more for the advanced C++ programmer. Try not to use Google if you can. When you are done post your solution and which challenge it is for. Here are the rules:
Rules:- No use of any functions
- No use of the '%', '*', and '/' operators
- No use of any classes
The challenges below should be placed in their own method and you should try and make it as small as you can, 1 line being the best if possible. Here are the challenges:
Challenges:- Make a function that takes a number as a parameter. Return an integer that is the power of two of the inputted number. So for example if the parameter is 5, it will return 25.
- Make a function that takes a number as a parameter. Return an integer that is the number divided by two. So for example if the parameter is 10, it will return 5.
- Make a function that takes a number as a parameter. Return a boolean value where true will be returned if the parameter is even or false if the parameter is odd. So for example if the parameter is 3 it will return false because it is odd.
HINT:
Use Bitwise operators!!!
Goodluck Everyone!
~Baseball435