forked from jieniyimiao/CppPrimer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex3_22.cpp
More file actions
28 lines (23 loc) · 661 Bytes
/
Copy pathex3_22.cpp
File metadata and controls
28 lines (23 loc) · 661 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
///
///Revise the loop that printed the first paragraph in text
///to instead change the elements in text that correspond
///to the first paragraph to all uppercase.
///After you’ve updated text, print its contents.
///
#include <iostream>
#include <vector>
#include <string>
#include <iterator>
using std::vector; using std::string; using std::cout; using std::cin; using std::endl;
int main()
{
vector<string> text;
for (string line; getline(cin, line); )
text.push_back(line);
for (auto it = text.begin(); it != text.end() && !it->empty(); ++it) {
for (auto &c : *it)
c = toupper(c);
cout << *it << endl;
}
return 0;
}