summaryrefslogtreecommitdiff
path: root/2.42-v4.cpp
diff options
context:
space:
mode:
Diffstat (limited to '2.42-v4.cpp')
-rw-r--r--2.42-v4.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/2.42-v4.cpp b/2.42-v4.cpp
new file mode 100644
index 0000000..f0d5a7e
--- /dev/null
+++ b/2.42-v4.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+#include "sales_data.hpp"
+
+/*
+ *
+ * 2.41 - 1.23 - 1.24
+ *
+ *
+ */
+
+int main () {
+
+ SalesData Item;
+ SalesData CurItem;
+ if(std::cin >> CurItem.BookNo >> CurItem.UnitsSold >> CurItem.Revenue) {
+ unsigned int Count = CurItem.UnitsSold;
+ while(std::cin >> Item.BookNo >> Item.UnitsSold >> Item.Revenue) {
+ if(Item.BookNo == CurItem.BookNo) {
+ Count += Item.UnitsSold;
+ } else {
+ std::cout << "ISBN: " << CurItem.BookNo << " has " << Count << " transactions" << std::endl;
+ CurItem = Item;
+ Count = Item.UnitsSold;
+ }
+ }
+ std::cout << "ISBN: " << CurItem.BookNo << " has " << Count << " transactions" << std::endl;
+ }
+
+ return 0;
+}