193030

String removal 2 small diff[again]

Feb 22nd, 2020
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6. string newString;
  7. string inputString;
  8. string removeString(string inputString)
  9. {
  10.     for(int i =0; i<inputString.length();i++)
  11.     {
  12.         if(inputString.at(i)!= '7') {
  13.           newString+=inputString.at(i);
  14.         }
  15.     }
  16.     return newString;
  17. }
  18.  
  19. int main() {
  20.     cout << "Enter the input string: "<< endl;
  21.  //   cin >> inputString >> endl;
  22.     getline(cin, inputString);
  23.     cout << "The new string is: " << removeString(inputString)<< endl;
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment