summaryrefslogtreecommitdiff
path: root/7p13.cpp
blob: bfacb6a277194b0a95252a56b30425e84a164c70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include "sales_data.hpp"

/*
 *
 * 7.13
 *
 *
 */

int main () {

	SalesData total(std::cin);
	if (std::cin) {
		SalesData trans(std::cin);
		while(std::cin) {
			if (total.isbn() == trans.isbn())
				total.combine(trans);
			else {
				print(std::cout, total) << std::endl;
				total = trans;
			}

			read(std::cin, trans);
		}
		
		print(std::cout, total) << std::endl;
	} else {
		std::cerr << "Error" << std::endl;
		return -1;
	}
	
	return 0;
}