-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17_sequence_container6.cpp
More file actions
98 lines (72 loc) · 1.8 KB
/
17_sequence_container6.cpp
File metadata and controls
98 lines (72 loc) · 1.8 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <vector>
#include <iostream>
#include <algorithm>
#include <list>
#include <string>
#include <fstream>
#include "show.h"
class FindChar
{
std::string data;
public:
FindChar(const std::string &s) : data(s) {}
inline bool operator()(const char &c) const
{
return std::find(data.begin(), data.end(), c) != data.end();
}
};
int main()
{
std::vector<std::string> v;
std::ifstream f("3_선형컨테이너6.cpp"); // current file name
std::string s;
while (std::getline(f, s))
v.push_back(s);
//----------------------------
std::reverse(v.begin(), v.end());
for (auto &n : v)
std::cout << n << std::endl;
//----------------------------
std::reverse(v[0].begin(), v[0].end());
for (auto &n : v)
std::cout << n << std::endl;
//----------------------------
for (auto &e : v)
{
std::reverse(e.begin(), e.end());
}
for (auto &n : v)
std::cout << n << std::endl;
//----------------------------
for (auto &e : v)
{
std::reverse(e.begin(), e.end());
}
for (auto &n : v)
std::cout << n << std::endl;
//----------------------------
for (auto &e : v)
{
std::replace(e.begin(), e.end(), 'i', ' ');
}
for (auto &n : v)
std::cout << n << std::endl;
//----------------------------
for (auto &e : v)
{
std::replace_if(
e.begin(), e.end(), [](char c)
{ return c == 'a' || c == 'e'; },
" ");
}
for (auto &n : v)
std::cout << n << std::endl;
//----------------------------
for (auto &e : v)
{
FindChar fc("aeiouAEIOU");
std::replace_if(e.begin(), e.end(), fc, " ");
}
for (auto &n : v)
std::cout << n << std::endl;
}