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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!