By Aalok Kumar
Hello programmers, Sometimes we need to replace the occurrence of the same characters with a different character in a string, So here is an implementation of that in C++.
In this C++ program,
function reverseStr(std::string str, char c1, char c2); It takes three arguments:
1. std::string str: Original string in which characters are to be replaced.
2. char c1: The character which is to be replaced from the original string str.
3. char c2: New character to be inserted in a place of old character.
The above function returns a new string in which all occurrences of c1 have been replaced by c2.
Submitted by Aalok Kumar (Aaloks766626)
Download packets of source code on Coders Packet
Comments