summaryrefslogtreecommitdiff
path: root/2.42-v2-2.cpp
diff options
context:
space:
mode:
Diffstat (limited to '2.42-v2-2.cpp')
-rw-r--r--2.42-v2-2.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/2.42-v2-2.cpp b/2.42-v2-2.cpp
new file mode 100644
index 0000000..f8f7872
--- /dev/null
+++ b/2.42-v2-2.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+#include "sales_data.hpp"
+
+/*
+ *
+ * 2.41 - 1.21
+ *
+ *
+ */
+
+int main () {
+
+ SalesData book1;
+ SalesData book2;
+ if(std::cin >> book1.BookNo >> book1.UnitsSold >> book1.Revenue) {
+ while(std::cin >> book2.BookNo >> book2.UnitsSold >> book2.Revenue) {
+ if(book1.BookNo != book2.BookNo) {
+ std::cout << "These books do not have the same ISBN" << std::endl;
+ continue;
+ }
+
+ std::cout << book1.BookNo << " " << book1.UnitsSold + book2.UnitsSold << " " << book1.Revenue + book2.Revenue << std::endl;
+ }
+ } else {
+ std::cout << "Error!" << std::endl;
+ return -1;
+ }
+
+ return 0;
+}