forked from Mooophy/Cpp-Primer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex3_22.cpp
More file actions
28 lines (23 loc) · 658 Bytes
/
ex3_22.cpp
File metadata and controls
28 lines (23 loc) · 658 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 <cctype>
using std::vector; using std::string; using std::cout; using std::cin; using std::isalpha;
int main()
{
vector<string> text;
for (string line; getline(cin, line); text.push_back(line));
for (auto& word : text)
{
for (auto& ch : word)
if (isalpha(ch)) ch = toupper(ch);
cout << word << " ";
}
return 0;
}