I have a vector of strings. Each vector element/string is a name, like: Mother_Hen.

I want to remove the _ and replace it with a space. Does anyone know how to do this? I have tried using find, but have had no success (I get no result). Thank you for any help.

Iterate through the vector and use string find/replace

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{char a[100],b;
 int c,d=0,e;
 gets(a);
 cout<<"enter the string to be found out";
 cin>>b;
 for(c=0;c<=strlen(a)-1;c++)
 {if(a[c]==b)
  d++;
 }
 if(d==0)
 cout<<"char not found";
 else
 cout<<"char found";
 getch();
}

i hope this works....have a nice time....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.