summaryrefslogtreecommitdiff
path: root/1p6.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-07-29 15:22:18 +0200
committerOskar <[email protected]>2024-07-29 15:22:18 +0200
commit7aac5c6dc29079971a5c964762cdb294782b14d5 (patch)
treef73768958b319ec6f01c32c67f6ee8b3e90f5b75 /1p6.cpp
parent5aac3c3f8bcfef0b2aad28d91d87b9ebf1d5e7df (diff)
more
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;
+}