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