Hey, I am trying to check and see if a user-inputed string contains just the newline character (i.e. a blank return). The code I have right now doesn't compile, and I believe that is because it would only work on a character, not a string:
Code:
while(getline(cin, searchWord) != NULL)
{
searchWord = modifyWord(searchWord);
if(searchWord == '\n')
{
searchResult = tree.search(searchWord);
if(searchResult != -1)
cout << searchWord << ": line " << searchResult << ".\n";
else
cout << searchWord << ": not found.\n";
}
}
I thought about checking the string size since the only case when that would be equal to 1 is when the only character in the string is the newline character, but I thought that that might bring up some problems also.