[C++ Primer] 练习3.10

#include 

using std::string;
using std::cout;
using std::cin;
using std::endl;

int main() {
    string test("hello, this is a test string. ");
    decltype(test.size()) size = 0;
    while (size < test.size()) {
        if (ispunct(test[size])) {
            test.erase(size, 1);
        }
        size++;
    }
    cout << test << endl;
}

你可能感兴趣的:([C++ Primer] 练习3.10)