Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have no idea how to do this I\'ve been trying to figure it out for hours Write

ID: 3805294 • Letter: I

Question

I have no idea how to do this I've been trying to figure it out for hours

Write a program that uses four boolean values as a group of on-off switches tomimic the way computer memory works. Each boolean value is one bit, and caneither be on or off. The program will ask the user for an integer between 0 andthe maximum number that can be represented by 4 bits, and then will convert thedecimal version of the integer into its base-2 representation by toggling thebits. Output the binary string of zeros and ones that represents the numberthe user entered. Do not worry about encoding negative numbers, assume you are only encodingpositive numbers.
There is more than one way to implement this program, but one strategy is toloop, adding one to the bit-array each time you loop, until you've looped anumber of times equal to the number entered.
Here is a start for your main function::
    // Our on-off switches (bits) that we'll use as memory.    

bool one   = false;

bool two   = false;

bool four = false;

bool eight = false;

int BITS = 4;    

int MIN = 0;    

int MAX = 15

Explanation / Answer

Please find the required solution: #include using namespace std; int main() { int input; int MIN = 0, MAX = 15; bool array[] = {false,false,false,false}; int BITS = 4; // take input coutinput; // iterate and set the bits to true or false for( int i = 0; i = 0; i-- ) { cout