Write a program using C++: I have come up with a what seems to be a valiad Algorithm but sure how to implement
Question:
See an advisor, talk to him, and isten to him.
should produce the following suggested changed version of the sentence:
See an advisor, talk to her or him, and listen to her or him.
************
HINT
************
Write a pattern matching function:
-> That returns to start index, of the fisrt instance of pattern in target.
-> Then the text to be edited for sexist language to be traversed for each instance of sexist language, searching and replacing instances as found.
Answer:
Well, better double check the psuedocode first; I see a runtime already. You have to match the whole word or it will return a false positive while looking for "he" when it finds "have". You should probably break the words in the sentence down into an array of strings and then compare them each to the word list of "sexist" suspects. This will also simplify replacement, since you can just concatenate the strings into one and re write it or display it as needed. I hope this helps.
More Questions & Answers...