Hi, I have a program that I am using to convert a string into binary. My current code is as follows:
int main(void) {
string userInput;
cout << "Enter a string to be converted:" << endl;
cin >> userInput;
for (int index = 0; index <= userInput.length(); index++) {
cout << userInput[index] << endl;
}
system("pause");
return 0;
}
The program only looks at the first word of user input and then the space but ignores the rest of the sentance. Eg.
input: hello dolly
output: hello
How can I include all of the user input into the string (including white spaces)?
--Dylan