Question: HELP ASAP! I need to submit this program right now, but its not properly running. I need to have no leading zeros as an output

HELP ASAP! I need to submit this program right now, but its not properly running. I need to have no leading zeros as an output after 0b. Except it is okay when I do 0x0 output 0b0. For instance, I should get 0x7d output 0b1111101 and it should not output 0b01111101. When you input 0x3E its output should be 0b111110 and not 0b00111110. When I input 0x1f I should get 0b11111. When making changes make sure that you always have 0x0 to output 0b0. Please help!

#include #include using namespace std; int main() { string hexa, value; // Hexadecimal and binary numbers in string bool void_num = false; cout << "Enter a hexadecimal number: "< 3) { for (size_t i = 0; i

if (value == "0000") { value = "0"; } value = "0b" + value; cout << "Your number in binary is " << value; cout << "." << endl; } return 0; }

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!