193030

String remove char

Feb 21st, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. string ns;
  5. strRemove(string s)
  6. {
  7.     for(int i =0; i<s.length(); i++){
  8.             if(s.at(i)!='p')
  9.             {
  10.                 ns+=s.at(i);
  11.             }
  12.  
  13.     }
  14. }
  15. using namespace std;
  16. int main()
  17. {
  18.  
  19.    string str1 = "lorem ipsum";
  20.    strRemove(str1);
  21.    cout << ns;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment