Question: Hi Im having trouble with this problem. So far I wrote the first function and its not working well. And I also need help with

Hi Im having trouble with this problem. So far I wrote the first function and its not working well. And I also need help with the second function.
Write a c++ program to convert binary numbers to decimal and decimal numbers to binary. You need to create two functions bin_to_dec and dec_to_bin.
bin_to_dec should take a binary number as a STRING and then convert it to an INT as a decimal number.
Dec_to_bin should take a decimal number as an INT and then convert it to a STRING as a binary number.
NOTE: These functions should only convert Unsigned(positive) numbers. DO NOT worry about signed numbers.
Thanks in advance.
 Hi Im having trouble with this problem. So far I wrote
the first function and its not working well. And I also need

int bin to dec(string s) INPUT(S): an UNsigned binary number as a string (e.g., "10110001") RETURN(S): the binary number converted to the equivalent decimal number PURPOSE: Converts any UNsigned binary number to decimal string dec to bin int n) INPUT(s): A non-negative decimal number (e.g, 15) RETURN(S): The decimal number converted to the equivalent binary number (as a string) PURPOSE: Converts any non-negative decimal number to binary

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!