this my code when i give the input of aeiou AEIOU
it only out puts xxxxx
where did i go wrong??? i want to replace every vowel in the entire string but i only does it for the first word is my code wrong ??
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
class remove_vowels_class
{
private:
public:
void remove_vowels_accept(string the_string)
{
std::replace(the_string.begin(),the_string.end(),'a','x');
std::replace(the_string.begin(),the_string.end(),'A','x');
std::replace(the_string.begin(),the_string.end(),'e','x');
std::replace(the_string.begin(),the_string.end(),'E','x');
std::replace(the_string.begin(),the_string.end(),'i','x');
std::replace(the_string.begin(),the_string.end(),'I','x');
std::replace(the_string.begin(),the_string.end(),'o','x');
std::replace(the_string.begin(),the_string.end(),'O','x');
std::replace(the_string.begin(),the_string.end(),'u','x');
std::replace(the_string.begin(),the_string.end(),'U','x');
std::replace(the_string.begin(),the_string.end(),'~',' ');
cout<<"the replaced string is :"<<the_string<<endl;
}
};
int main()
{
remove_vowels_class maniobj;
string input_string;
cout<< "Enter a string to replace all vowels:"<<endl;
cin>>input_string;
std::replace(input_string.begin(),input_string.end(),' ','~');
maniobj.remove_vowels_accept(input_string);