Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void deleteChar(char str[], char c) {
- int index = 0;
- int chars = 0;
- while (str[index] != '\0') {
- while (str[index+chars] == c) {
- chars++;
- }
- str[index] = str[index+chars];
- index++;
- }
- }
- int main () {
- char test[] = "cadena de pruebaaaaaaaaaaaaaaaaaaaaaaaaassssasdas";
- deleteChar(test, 'a');
- int index = 0;
- while (test[index] != '\0') {
- cout << test[index];
- index++;
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment