Question: /*Create a variable at the top of your code named power2 and assign it the value 8 Create a variable at the top of your
/*Create a variable at the top of your code named power2 and assign it the value 8 Create a variable at the top of your code named result and assign it the value 0 Ask the user to enter FOUR 1's and 0's followed by a '*' In the loop, when the letter is '1' add power2 to result and store it back into result In the loop, change power2 to be the next lower power of 2
After the loop do a cout to print the result and explain it is decimal
In other words, the program used to do this: 0101* 0101
Now it should do this 0101* That is 5 in decimal*/
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
