[c++] 문자열의 특정 문자 제거하기
#include <iostream>
#include <string>

std::string removeChar(std::string str, char c) {
    std::string result;
    for (char ch : str) {
        if (ch != c) {
            result += ch;
        }
    }
    return result;
}

int main() {
    std::string input = "example string with characters to remove";
    char charToRemove = 'e';
    std::string output = removeChar(input, charToRemove);
    std::cout << "Result: " << output << std::endl;
    return 0;
}

위의 코드는 removeChar 함수를 사용하여 입력 문자열에서 특정 문자를 제거합니다. main 함수에서 이 함수를 호출하고 결과를 출력하고 있습니다.

이 예제는 간단한 방법을 보여줍니다만, 실제로는 입력 문자열을 변경하지 않고 새로운 문자열을 만들어 반환해야 합니다.