Write a program using C++: I have come up with a what seems to be a valiad Algorithm but sure how to implement


Question:
Write a program that can be used to train the user to use less sexist language by suggesting alternative versions of sentences given by the user. The program will ask for a sentence, read the sentence into a string variable, and replace all occurences of masculine pronouns with gender-neutral pronouns. For example, it will replace "he" with "she or he". Thus, the innput sentence:

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...
  • The system advisor on my computer says I need to have an anti-spam program on my computer. What do you suggest
  • Has anyone participated in the LPN to BSN online program thru The College Network?
  • Need to block sites in a company?
  • How much Spanish do I need to know to teach it at the middle school level?
  • A question for any Health/Sex Education teachers out there...?
  • Why does not Yahoo Customer Service respond?
  • How to become an independent financial advisor?
  • (Revised) What are my chances of getting into graduate school with a mediocre GPA?
  • The questions and answers post by the user, for information only, AnswersRoom.com does not guarantee the right
    Copyright © 2007 AnswersRoom.com -   Terms of Use -   Contact us

    Hot Topic