blob: 4183d0c1b10b647cae0d2c976aaa31be8495b9fa (
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
|
#include <iostream>
#include "sales_data.hpp"
/*
*
* 7.1
*
*
* Not really sure if we're supposed to add the data of the
* other members but i assume not because now i literally
* just changed 1.24 to fit the sales_data format
*/
int main () {
SalesData Item;
SalesData CurItem;
if(std::cin >> CurItem.BookNo >> CurItem.UnitsSold >> CurItem.Revenue) {
int Count = 1;
while(std::cin >> Item.BookNo >> Item.UnitsSold >> Item.Revenue) {
if(Item.BookNo == CurItem.BookNo) {
Count++;
} else {
std::cout << "ISBN: " << CurItem.BookNo << " has " << Count << " transactions" << std::endl;
CurItem = Item;
Count = 1;
}
}
std::cout << "ISBN: " << CurItem.BookNo << " has " << Count << " transactions" << std::endl;
}
return 0;
}
|