-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2_12.cpp
More file actions
29 lines (25 loc) · 818 Bytes
/
2_12.cpp
File metadata and controls
29 lines (25 loc) · 818 Bytes
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
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
void main2_12() {
string str1 = "wearehere!", str2(str1);
reverse(str1.begin(), str1.end());
cout << str1 << endl;
copy(str1.begin(), str1.end(), str2.begin());
sort(str1.begin(), str1.end());
cout << str1 << endl;
cout << str2 << endl;
reverse_copy(str1.begin(), str1.end(), str2.begin());
cout << str2 << endl;
reverse(str2.begin() + 2, str2.begin() + 8);
copy(str2.begin() + 2, str2.begin() + 8, ostream_iterator<char>(cout));
cout << endl;
sort(str1.begin(), str1.end(), greater<char>());
cout << str1 << endl;
str1.swap(str2);
cout << str1 << " " << str2 << endl;
cout << (* find(str1.begin(), str1.end(), 'e') == 'e') << " "
<< (* find(str1.begin(), str1.end(), 'O') == 'O') << endl;
}