Question: (Use the string class to solve the problem)Write a C++ program that can be used to train the user to use less sexist language by
(Use the string class to solve the problem)Write a C++ 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 occurrences of masculine pronouns with gender-neutral pronouns. For example, it will replace he with she or he, and him with her or him. Thus, the input sentence See an adviser, talk to him, and listen to him.
should produce the following suggested changed version of the sentence:See an adviser, talk to her or him, and listen to her or him.Be sure to preserve uppercase letters for the first word of the sentence. The pronoun his can be replaced by her(s) or his; your program need not decide between her and hers. Allow the user to repeat this for more sentences until the user says she or he is done.You need to take care of the following string replacements:he/she -> she or hehim/her -> her or himhis/her(s) -> her(s) or his

1. This exercise is more complicated than it looks. You cannot just use a string variable and use >> to read a string at a time since there are punctuation marks, such as comma, or period, that you don't want to be included in a string. So you will have to read in a character at a time and decide whether it is an alphabet or not. So it is convenient that you define the following function: bool IsAlphabet(char ch); 2. Read in one character at a time, check if it is an alphabet, if so, concatenate it to the current word, using a string "+" operator, for example. When you finish building a word, you can then work on the replacement as in the next step. string sentence, osentence: getlineccin, sentence); for (int i-0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
