|
Can anyone help me do this please??
I've been stuck on this for a few weeks
The user enters 0010101 and 010100. These should be converted to decimal (21 and 20, respectively). The Finch will speak that: “The two numbers entered are 21 and 20. Their sum is 41 and when multiplied gives 420. Subtracting the two numbers gives 1”.
Please note that the program must *not* use a simple loop which tests for all 127 cases of decimal number in the case of the 7-binary digit number etc. The program must incorporate a proper algorithm for converting the number by parsing (i.e. searching) the string of bits.
The program should be tested with binary numbers input from the keyboard as well as from a file. You may decide how the two binary numbers in the file are formatted, e.g., one after the other or separated with a new line.
|