summaryrefslogtreecommitdiff
path: root/1p24.cpp
blob: bb9336ef583728e95f3e8ad396839d902171ab26 (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
#include <iostream>
#include "sales_item.hpp"

/*
 *
 * 1.24 exercise
 *
 *
 */

int main () {

	Sales_item Item;
	Sales_item CurItem;	
	if(std::cin >> CurItem) {
		int Count = 1;
		while(std::cin >> Item) {
			if(Item.isbn() == CurItem.isbn()) {
				Count++;
			} else {
				std::cout << "ISBN: " << CurItem.isbn() << " has " << Count << " transactions" << std::endl;
				CurItem = Item;
				Count = 1;
			}
		}
		std::cout << "ISBN: " << CurItem.isbn() << " has " << Count << " transactions" << std::endl;
	}

	return 0;
}