Problem solving with programming: Removing a given character from the string
Given a string and a character, Write a function to remove all instances of the character and return the modified string.
Read full article from Problem solving with programming: Removing a given character from the stringvoid removeChars(string &str, char ch){int i;int resInd = 0; //Result string indexfor( i = 0; i < str.length(); i++ ){//retain str[i] only if it is not chif( str[i] != ch ){str[resInd] = str[i];resInd++;}}//Resize the string so that chars beyond resInd will be erased.str.resize(resInd);}