Greetings All,
My problem is explained exactly as in the thread title: Detecting two consecutive spaces in string. I'm trying to perform some error detection and I need to detect to consecutive spaces. This is what I tried but to no avail.
-------------------------
Code:
cout << endl << " Please enter item name: ";
getline(cin, itemName,'\n');
NewItemLength = itemName.length();
loopCount2 = 0;
while (loopCount2 > 2)
{
cin.get(Letter);
if (Letter == ' ')
loopCount2++;
cout << loopCount2;
}
----------------------
The cout loopCount2 is just to show if any whitespaces were picked up. Please help.
Thanks,
bob2509