Program that deletes the punctuation

Hi, I'm working on a program that deletes the punctuation, the program should get some sentence and then write all the words in colon without punctation.
The code is in Stroustrup Programming prin&prac using c++.
Now, I'm running it on my smartphone since I have an old version of g++ that don't compile on code::blocks.
On my smartphone the program compiles, but it doesn't give me the output.
Here the code


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 #include "std_lib_facilities.h"
class Punct_stream
{

public:
    Punct_stream(istream& is)
        :source{is},sensitive{true} {}

    void whitespace (const string& s)
                       {white=s;}

    void add_white(char c) {white+=c;}
    bool is_whitespace(char c);
    void case_sensitive(bool b){sensitive=b;}
    bool is_case_sensitive() {return sensitive;}
    Punct_stream& operator>>(string& s);
    operator bool();

private:
    istream& source;
    istringstream buffer;
    string white;
    bool sensitive;




};
Punct_stream& Punct_stream::operator>>(string&s)
{
while(!(buffer>>s))
    {if(buffer.bad()||!source.good())return *this;
     buffer.clear();

    string line;
    getline(source,line);
    for(char& ch: line)
        if(is_whitespace(ch))
           ch=' ';
    else if(!sensitive)
        ch=tolower(ch);
    buffer.str(line);

    }
    return *this;
}

bool Punct_stream::is_whitespace(char c)
{
    for (char w : white)
        if(c==w) return true;
    return false;
}
Punct_stream::operator bool()
{
    return !(source.fail()||source.bad())&&source.good();
}





int main()
{
    Punct_stream ps {cin};
    ps.whitespace(";:,.?!()\"{}<>/&$%@#%^*|");
    ps.case_sensitive(false);
    cout << "Please enter words" << endl;
    vector<string> vs;
    for(string word; ps>>word;)
        vs.push_back(word);
    sort(vs.begin(),vs.end());
    for(int i=0;i<vs.size();i++)
        if(i==0|| vs[i]!=vs[i-1])cout<<vs[i]<<'\n';
    return 0;
}

I want ask if the program give also to you the same issue or if it's only my problem.
If you can tell me where is the error/s I'll be very happy.
Thank to everyone.
Topic archived. No new replies allowed.