-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10.06.cpp
More file actions
36 lines (34 loc) · 691 Bytes
/
10.06.cpp
File metadata and controls
36 lines (34 loc) · 691 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
30
31
32
33
34
35
36
#include <algorithm>
#include <list>
#include <iostream>
#include <sstream>
#include <string>
#include <iterator>
using std::string;
using std::cout;
using std::endl;
using std::list;
using std::fill_n;
using std::cin;
using std::back_inserter;
using std::istringstream;
using std::getline;
int main() {
list<int> numbers;
string line;
while (getline(cin, line)) {
istringstream stream(line);
auto backI = back_inserter(numbers);
for (int temp; stream >> temp; *backI = temp) ;
}
for (const int &i : numbers) {
cout << i << ' ';
}
cout << '\n';
fill_n(numbers.begin(), numbers.size(), 0);
for (const int & i : numbers) {
cout << i << ' ';
}
cout << endl;
return 0;
}