Skip to content

Instantly share code, notes, and snippets.

@krysseltillada
Created July 1, 2015 13:22
Show Gist options
  • Save krysseltillada/ebb718c72cbc5f286ea2 to your computer and use it in GitHub Desktop.
Save krysseltillada/ebb718c72cbc5f286ea2 to your computer and use it in GitHub Desktop.
Sales_data class
#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