The following code is supposed to read in input from the keyboard, encode it to a string, and then take each digit from the string and put it into an integer array for the purposes of adding two binary numbers together.
See below for the test input and result.
Can anyone explain why this is so and how to fix it? I want to make sure I'm getting the right numbers in the right places before I move forward, as it will make the rest of the work that much easier.
#include <iostream>#include <string>
using namespace std;
int b1, b2, b3;
string s1, s2;
cout << "Please enter the first binary number to add: ";
cin >> s1;
cout << endl << endl;
for(int i=0; i<8; i++)
cout << b1;