1 #include <iostream>
2 #include <string>
3 using namespace std;
4
5
6 int main()
7 {
8 //3.6
9 string str("some thing");
10 for(decltype(str.size()) i = 0 ; i<str.size() ; ++i)
11 if(!isspace(str[i]))str[i]='X';
12
13 cout<<str<<endl;
14 //3.7
15 str="some thing";
16 for(auto &c:str)
17 if(!isspace(c))
18 c='X';
19
20 cout<<str<<endl;
21 //3.8
22 str="some thing";
23 string::size_type index=0;
24 while(index<str.size()){
25 if(!isspace(str[index]))str[index]='X';
26 index++;
27 }
28 cout<<str<<endl;
29 //3.10
30 string sentence,osentence;
31 cin>>sentence;
32 for(auto c:sentence){
33 if(!ispunct(c))osentence+=c;
34 }
35 cout<<osentence<<endl;
36 return 0;
37 }