summaryrefslogtreecommitdiff
path: root/3p24.cpp
blob: 1ae1ef2f30f32c546753a0af915a9b2bf9d53789 (plain)
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
#include <iostream>
#include <vector>
#include "sales_data.hpp"
#include "sales_item.hpp"

/*
 *
 * 3.24
 *
 *
 */

using std::string;
using std::cout;
using std::cin;
using std::cerr;
using std::clog;
using std::endl;
using std::vector;
int main () {

    vector<int> VecNumbers;
	int Numbers = 0;	
	while(cin >> Numbers) {
		VecNumbers.push_back(Numbers);
	}
	
	for(auto Iterate = VecNumbers.cbegin() ; Iterate < VecNumbers.cend() ; Iterate += 2) {
		auto First = Iterate;
		auto Second = Iterate + 1;
		cout << *First + *Second << " ";                         
	}

	cout << endl;
	auto vnend = VecNumbers.cend()-1;
	auto vnbeg = VecNumbers.cbegin();
	while(vnbeg <= vnend) {
	    if (vnbeg == vnend) {
			cout << *vnbeg + *vnend << " ";
			break;
		}
		
		cout << *vnbeg + *vnend << " ";
		--vnend;
		++vnbeg;
	}

	cout << endl;
	return 0;
}