summaryrefslogtreecommitdiff
path: root/1p6.cpp
diff options
context:
space:
mode:
Diffstat (limited to '1p6.cpp')
-rw-r--r--1p6.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/1p6.cpp b/1p6.cpp
new file mode 100644
index 0000000..71dfd28
--- /dev/null
+++ b/1p6.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 1.6 example
+ *
+ *
+ */
+
+int main () {
+
+ Sales_item Total;
+ Sales_item Trans;
+ if(std::cin >> Total) {
+ while(std::cin >> Trans) {
+ if(Trans.isbn() == Total.isbn()) {
+ Total += Trans;
+ } else {
+ std::cout << Total << std::endl;
+ Total = Trans;
+ }
+ }
+
+ std::cout << Total << std::endl;
+ } else {
+ std::cerr << "Error" << std::endl;
+ return -1;
+ }
+
+ return 0;
+}