A binary number is a base-2 number composed of the binary digits (bits) 0 and 1. For
example, the binary numbers 1, 10, 11, 111 are of decimal values 1, 2, 3, 7,
respectively. Addition of two binary digits follow the rules of 0+0=0, 0+1=1, 1+0=1 and
1+1=10. The sum of two binary numbers can then be obtained in the same way as
we add two decimal numbers, i.e., starting from the least significant place, we add the
corresponding digits of the two numbers and propagate any carry digit to the next,
more significant place. The following two figures illustrate the addition for decimal
numbers and for binary numbers. Note that the carry bit for binary addition can only In 1.cpp , write a C++ program that reads two strings, each representing a binary
number, supplied by the user. The input strings are therefore binary strings containing
a sequence of 0’s and 1’s. Your program should output the sum of the two binary
numbers. You may assume that the input numbers, if nonzero, always start with a 1 .
This is the same for the output sum, i.e., a nonzero sum should always start with a
1 . You should NOT make any assumption to the maximum length of the input
binary strings (i.e., the input strings can be as long as what a string object in C++
The answer is 1246, not 2434 as you are doing above. In decimal, you add units, tens, hundreds, ... together and not mix them, and have to use carry to cross these boundaries. The same goes for binary.