forked from Mooophy/Cpp-Primer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex3_17.cpp
48 lines (41 loc) · 979 Bytes
/
ex3_17.cpp
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
///
///@Author PEZY
///@Date Aug. 2014
///@Brief
/// Read a sequence of words from cin and store the values a vector.
/// After you've read all the words, process the vector and change each word to uppercase.
/// Print the transformed elements, eight words to a line.
///
#include <iostream>
#include <vector>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;
int main()
{
vector<string> vec;
string word;
while (cin >> word)
vec.push_back(word);
for (auto &str : vec)
for (auto &c : str)
c = toupper(c);
for (decltype(vec.size()) i=0; i != vec.size(); ++i)
{
if (i%8 == 0) cout << endl;
cout << vec[i] << " ";
}
cout << endl;
return 0;
}
///
///@Output
///pezy is a good programmer you can ask any question to him all the time he is playing the codes
///^D(EOF)
///PEZY IS A GOOD PROGRAMMER YOU CAN ASK
///ANY QUESTION TO HIM ALL THE TIME HE
///IS PLAYING THE CODES
///