(invalid_argument) Programming Exercise specifies thebin2Dec(const string& binaryString) function that returns a decimal number from a binary string. Implement the bin2Dec function to throw a invalid_argument exception if the string is not a binary string. Write a test program that prompts the user to enter a binary number as a string and displays the number in decimal.
Programming Exercise (Binary to decimal) Write a function that returns a decimal number from a binary string. The function header is as follows:
int bin2Dec(const string& binaryString)
For example, binary String 10001 is 17 (1 * 24 + 0 * 23 + 0 * 22 + 0 * 2 + 1 = 17). So, bin2Dec("10001") returns 17. Write a test program that prompts the user to enter a binary number as a string and displays its decimal equivalent value.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.