diff options
author | Oskar <[email protected]> | 2024-07-29 15:22:18 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-07-29 15:22:18 +0200 |
commit | 7aac5c6dc29079971a5c964762cdb294782b14d5 (patch) | |
tree | f73768958b319ec6f01c32c67f6ee8b3e90f5b75 /1p6.cpp | |
parent | 5aac3c3f8bcfef0b2aad28d91d87b9ebf1d5e7df (diff) |
more
Diffstat (limited to '1p6.cpp')
-rw-r--r-- | 1p6.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ +#include <iostream> +#include "sales_item.hpp" + +/* + * + * 1.6 example + * + * + */ + +int main () { + + Sales_item Total; + Sales_item Trans; + if(std::cin >> Total) { + while(std::cin >> Trans) { + if(Trans.isbn() == Total.isbn()) { + Total += Trans; + } else { + std::cout << Total << std::endl; + Total = Trans; + } + } + + std::cout << Total << std::endl; + } else { + std::cerr << "Error" << std::endl; + return -1; + } + + return 0; +} |