summaryrefslogtreecommitdiff
path: root/7p3.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-09-17 16:36:14 +0200
committerOskar <[email protected]>2024-09-17 16:36:14 +0200
commit46dd78806ebac69c88cb07cecb3afae1835b783a (patch)
tree69f5c404612d884d4d6ff12304eb650985a71263 /7p3.cpp
parentd8d8f1c987f118843d44ea27ac516f8fe866ded4 (diff)
more
Diffstat (limited to '7p3.cpp')
-rw-r--r--7p3.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/7p3.cpp b/7p3.cpp
new file mode 100644
index 0000000..eee5db3
--- /dev/null
+++ b/7p3.cpp
@@ -0,0 +1,36 @@
+#include <iostream>
+#include "sales_data.hpp"
+
+/*
+ *
+ * 7.3
+ *
+ * This exercise is not correct and honestly i am not sure
+ * what is supposed to be correct. It may be because i misunderstood
+ * The exercise back in the 1.24 exercise.
+ *
+ * I have modified this program now to be more like i think it should be.
+ */
+
+int main () {
+
+
+ SalesData CurItem;
+ if(std::cin >> CurItem.BookNo >> CurItem.UnitsSold >> CurItem.Revenue) {
+ SalesData Item;
+ while(std::cin >> Item.BookNo >> Item.UnitsSold >> Item.Revenue) {
+ if(Item.isbn() == CurItem.isbn()) {
+ CurItem.combine(Item);
+ } else {
+ std::cout << "ISBN: " << CurItem.BookNo << " has " << CurItem.UnitsSold << " units sold"
+ << " and a revenue of: " << CurItem.Revenue << std::endl;
+ CurItem = Item;
+ }
+ }
+
+ std::cout << "ISBN: " << CurItem.BookNo << " has " << CurItem.UnitsSold << " units sold"
+ << " and a revenue of: " << CurItem.Revenue << std::endl;
+ }
+
+ return 0;
+}