I'm not sure if this is what you want to use the function for, but anyway:
Code:
#include <string>
#include <iostream>
using namespace std;
void RuleThree(string word, string target)
{
string temp1, temp2;
int len = word.length()-1; // Index of last character
cout << target << endl;
temp2 = word.substr(0,2);
if (temp2 == "TH" || temp2 == "th")
return;
else
{
temp1 = word.substr(1,len);
word = temp1 + target + "AY";
cout << word << endl;
}
} // End function RuleThree
int main()
{
string one = "THAT'S the joint!";
RuleThree("THAT'S", one);
return 0;
}