diff options
author | Oskar <[email protected]> | 2024-08-03 22:51:15 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-03 22:51:15 +0200 |
commit | 1d105b91b9678ffaa8eddea2218ed1789f5be27c (patch) | |
tree | 89563fd6bcbe5411b244ac361098fbdddc321f5f /3.1-v2-2.cpp | |
parent | 0de72ab100011ab54f99f298e936327011ebc706 (diff) |
more assignments
Diffstat (limited to '3.1-v2-2.cpp')
-rw-r--r-- | 3.1-v2-2.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/3.1-v2-2.cpp b/3.1-v2-2.cpp new file mode 100644 index 0000000..0ac8ac3 --- /dev/null +++ b/3.1-v2-2.cpp @@ -0,0 +1,32 @@ +#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; + if(cin >> book1.BookNo >> book1.UnitsSold >> book1.Revenue) { + while(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; + } + } else { + cout << "Error!" << endl; + return -1; + } + + return 0; +} |