summaryrefslogtreecommitdiff
path: root/1p23.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 /1p23.cpp
parent5aac3c3f8bcfef0b2aad28d91d87b9ebf1d5e7df (diff)
more
Diffstat (limited to '1p23.cpp')
-rw-r--r--1p23.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/1p23.cpp b/1p23.cpp
new file mode 100644
index 0000000..bb9336e
--- /dev/null
+++ b/1p23.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 1.24 exercise
+ *
+ *
+ */
+
+int main () {
+
+ Sales_item Item;
+ Sales_item CurItem;
+ if(std::cin >> CurItem) {
+ int Count = 1;
+ while(std::cin >> Item) {
+ if(Item.isbn() == CurItem.isbn()) {
+ Count++;
+ } else {
+ std::cout << "ISBN: " << CurItem.isbn() << " has " << Count << " transactions" << std::endl;
+ CurItem = Item;
+ Count = 1;
+ }
+ }
+ std::cout << "ISBN: " << CurItem.isbn() << " has " << Count << " transactions" << std::endl;
+ }
+
+ return 0;
+}