• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

some help needed:)

Zysen

=)
Joined
Sep 18, 2010
Messages
2,270
Reaction score
170
Location
Bosnia & Herzegovina
Hi guys, I'm a beginner in C++ and I've got a question. It's a kind of a newbie question but I need help.

I need to change vowels with a specific letter, lets say 'x'.
I've tried on google, but couldn't find anything. Could someone write the code and explain it to me?
 
Strings can be used as a container, so loop through the string and look for matches and then replace.
For example:
Code:
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
  {
  string s = "replacing ass letter";
  replace( s.begin(), s.end(), 's', 'l' );
  cout << s << endl;
  return 0;
  }

That's what I know, I'm pretty sure there's a better solution.
 
Back
Top