Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program in borland c++that can be used to train the user to use less sex

ID: 3623207 • Letter: W

Question

write a program in borland c++that can be used to train the user to use less sexist language by suggesting alternative versions given by theuser. The program will ask for a sentence, read the sentence into a string variable, and replac alloccurences of masculine pronouns with gender-neutral pronouns. For example, it will replace "he" with "she or he". Thus, the input sentence
see on adviser, talk to him, and listen to him.
should produce the following suggested changed version of the sentence:
see on adviser, talk to her or him, and listen to her or him.
Be sure to preserbe uppercase letters for the first word of the sentence. The pronoun "his" can be replaced by "her(s)"; your program need not decide between "her" and "hers". Allow the user to repeat this for more sentence until the user says she or he isdone.
Your program should not replace the string "he" when it occurs inside another word, such as "here". A word is any string consisting of the letters of the alphabet and delinited at each endby a blank, the end of the line, or any othe character that is nota letter. Allow your sentence to be up tp 100 character long.

Explanation / Answer

please rate - thanks

#include<iostream>
#include <string.h>
using namespace std;
void replaceString(string &,string,string);
int main()
{string input;
string lookfor[]={"he","him","his"};
string replace[]={"she or he","her or him","hers or his"};
int i;
cout<<"Enter a string enter return when done: ";
getline(cin,input);
while(input[0]!='')
   {for(i=0;i<3;i++)
        replaceString(input,lookfor[i],replace[i]);
    input[0]=toupper(input[0]);
    cout<<"The new string is: "<<input<<endl;
    cout<<"Enter a string enter return when done: ";
    getline(cin,input);
    }
system("pause");
return 0;
}
void replaceString(string &in ,string change,string to)
{string::size_type pos;
pos=in.find(change,0);
while (pos !=in.npos)
   {if((isspace(in[pos-1])||pos==0)&&
   (isspace(in[pos+change.length()])||ispunct(in[pos+change.length()])
     ||in[pos+change.length()]==''))
       {in.erase(pos,change.length());
        in.insert(pos,to);
        pos=in.find(change,pos+to.length());
       }
    else
       pos=in.find(change,pos+1);
      
   }
return;
}