Hello all,

I'm trying to write a binary to decimal conversion program. I'm stuck at the very beginning here because I can't figure out how to allow the user to input the entire binary string while allowing me to break it apart and process it..

I've tried

int BinInput[*];
cout << "Enter the binary number to be converted to decimal: ";
cin >> BinInput;
for each(int x in BinInput)
	cout << "\n" << x;

Use std::string

std::string binaryNumber;
cin >> binaryNumber;
for(int i = 0; i < binaryNumber.size(); ++i)
 cout << binaryNumber[i] << endl;

You must have started learning programming on BASIC, or another similar language. There is no for each language construct in current Standard C++.

I suggest you take your input as a string, then iterate through the string as if it were an array. Then, based on the character contained at each index, add a value to an accumulator.

Oops, overlapped with firstPerson...