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