Hi . what is my fault . the compiler return ISO C++ forbids comparison between pointer and integer|
int main()
{
string word;
cout <<"\n enter word\n: ";
getline(cin,word);
for(int i = 0 ; i < word.size(); i++)
{
if(word[i] == " ")
cout <<" find space";
}
return 0;
}
Single quotes are for character literals. Double quotes are for string literals (the null character is appended by default). Since word is a std::string, word[i] (if i is in range) is a character, so you must compare it to another character, not to a std::string.