summaryrefslogtreecommitdiff
path: root/3p24.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3p24.cpp')
-rw-r--r--3p24.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/3p24.cpp b/3p24.cpp
new file mode 100644
index 0000000..1ae1ef2
--- /dev/null
+++ b/3p24.cpp
@@ -0,0 +1,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;
+}