I have a question about the relational != operator.
First here is part of my code:
Code:
void RuleThree(string word, string target)
{
string temp;
int len = word.length()-1; // Index of last character
cout << target << endl;
if (target!="TH" || target!="th") // here is the problem!!
{
temp = word.substr(1,len);
word = temp + target + "AY";
cout << word << endl;
}
} // End function RuleThree
This is simply not working. When my word starts with TH or th, it still accepts the word and goes through the code. When I do this though:
if (target!="TH" || target=="th")
where only one of them is set to not equal to, it works.
The problem is that I have to add more than just the TH and th to the if statement, but when I do, it treats it as an equal to.
I just don't get it.
Any help would be appreciated