954,170 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Finding and Replacing Strings

I kinda have a problem. What i'm tryin to do is read a couple or lines or so from a text file and then replace all the gender pronouns ie(he, she, him, her) and replace those with gender neutral ones. The problem i'm having is trying to find all the gender pronouns and replacing them Her is a example of my code so far. Any help would be a God send.

#include
#include
#include


using namespace std;

int main()
{
ifstream gender;
gender.open("Proj1.txt");
string str1="", str2=" he", str3=" she", str4=" him", str5=" her",str;
int pos =0;
if (gender.is_open())
{


while(!gender.eof())
{
getline(gender, str1);
pos=str1.find(str2,0);
cout<

blackspyder01
Newbie Poster
2 posts since Sep 2003
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You