Question
Complete the following function that takes an integer as an argument and returns a power of two greater than or equal to input. If input
Complete the following function that takes an integer as an argument and returns a power of two greater than or equal to input. If input is less than 1, the function should return 0. If input would cause an overflow, return 0.
Example input/output: 1. 8 => 8 2. 15 => 16 2. 17 => 32
Note: - Feel free to use a text editor or IDE of your choice to do this instead. - If you do, simply just copy-paste your code here when you're done. - Do not change function signature. - You are free to add any supporting helper functions, data types, or structures you wish. - You may make use of STL data structures and algorithms - main function has been provided to make code run inside Rextester Web IDE. It is not required to be part of the submission and will not be graded.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started