summaryrefslogtreecommitdiff
path: root/7p1.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-09-17 15:02:56 +0200
committerOskar <[email protected]>2024-09-17 15:02:56 +0200
commitd8d8f1c987f118843d44ea27ac516f8fe866ded4 (patch)
tree0489d8d0565c8941422358e52dc6394cbf03db86 /7p1.cpp
parentc640d847343b3d50e7716173141d63bd1cca265c (diff)
more
Diffstat (limited to '7p1.cpp')
-rw-r--r--7p1.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/7p1.cpp b/7p1.cpp
new file mode 100644
index 0000000..4183d0c
--- /dev/null
+++ b/7p1.cpp
@@ -0,0 +1,33 @@
+#include <iostream>
+#include "sales_data.hpp"
+
+/*
+ *
+ * 7.1
+ *
+ *
+ * Not really sure if we're supposed to add the data of the
+ * other members but i assume not because now i literally
+ * just changed 1.24 to fit the sales_data format
+ */
+
+int main () {
+
+ SalesData Item;
+ SalesData CurItem;
+ if(std::cin >> CurItem.BookNo >> CurItem.UnitsSold >> CurItem.Revenue) {
+ int Count = 1;
+ while(std::cin >> Item.BookNo >> Item.UnitsSold >> Item.Revenue) {
+ if(Item.BookNo == CurItem.BookNo) {
+ Count++;
+ } else {
+ std::cout << "ISBN: " << CurItem.BookNo << " has " << Count << " transactions" << std::endl;
+ CurItem = Item;
+ Count = 1;
+ }
+ }
+ std::cout << "ISBN: " << CurItem.BookNo << " has " << Count << " transactions" << std::endl;
+ }
+
+ return 0;
+}