Created
July 1, 2015 13:22
-
-
Save krysseltillada/ebb718c72cbc5f286ea2 to your computer and use it in GitHub Desktop.
Sales_data class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> /// std::cout; std::endl; std::cerr; | |
| #include "Sales_data.h" /// Sales_data; o.isbn(); | |
| int main () | |
| { | |
| Sales_data total; | |
| if (std::cin >> total) { | |
| Sales_data trans; | |
| while (std::cin >> trans) { | |
| if (total.isbn() == trans.isbn()) | |
| total += trans; | |
| else { | |
| std::cout << total << std::endl; | |
| total = trans; | |
| } | |
| } | |
| std::cout << total << std::endl; | |
| } else { | |
| std::cerr << "No data?!" << std::endl; | |
| return -1; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment