Laitofai

6

May 5th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. //#6
  2. #include <iostream>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     char str[50];
  10.     char cifra;
  11.     cin.getline(str, 50);
  12.     cin >> cifra;
  13.     int n = strlen(str);
  14.     for(int i = 0; i < n; i++){
  15.         if(str[i] == cifra){
  16.             for(int j = i + 1; j < n; j++){
  17.                 str[j - 1] = str[j];
  18.             }
  19.             i--;
  20.             n--;
  21.         }
  22.     }
  23.     for(int i = 0; i < n; i++){
  24.         cout << str[i];
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment