Reputation: 99
I am making a program that converts an English sentence into pig latin. I keep getting the error "ISO C++ forbids comparison between pointer and integer [-fpermissive]" on line 16. any help?
void wordfinder();
string word;
string engSent;
int x;
int main()
{
cout << "Enter a sentence: ";
getline(cin, engSent);
string word = "";
for (x = 0; x < engSent.length(); x++)
{
if (engSent[x] == " " || engSent[x] == "," || engSent[x] == ".")
{
wordfinder();
word = "";
}
}
return 0;
}
void wordfinder()
{
word = engSent.substr(0,engSent[x]);
cout << word;
}
Upvotes: 1
Views: 323
Reputation: 2556
examine for characters not strings in:
if (engSent[x] == ' ' || engSent[x] == ',' || engSent[x] == '.')
Upvotes: 3