fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. int main()
  5. {
  6. char letters[] = "aabbccbccd";
  7.  
  8. // this will point to the first character of the sequence that is to be
  9. // removed.
  10. char *ptrStart = std::remove(std::begin(letters), std::end(letters), 'b');
  11.  
  12. *ptrStart = '\0'; // null terminate this
  13. std::cout << "The characters after erasing are: " << letters;
  14. }
  15.  
  16.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
The characters after erasing are: aaccccd