Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char str[20],deletechar,reStr[20]="";
- cout<<"Enter String:\n";
- cin>>str;
- cout<<"Enter Character which you want to delete:\n";
- cin>>deletechar;
- //write your logic here
- for(int index = 0, str_index = 0; index < 20; index++)
- {
- if(str[index] != deletechar)
- {
- reStr[str_index] = str[index];
- str_index++;
- }
- }
- //end
- cout<<"Result String is:\n";
- cout<<reStr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment