forked from Mooophy/Cpp-Primer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex7_07.cpp
More file actions
34 lines (31 loc) · 655 Bytes
/
ex7_07.cpp
File metadata and controls
34 lines (31 loc) · 655 Bytes
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
//
// ex7_07.cpp
// Exercise 7.7
//
// Created by pezy on 11/8/14.
// Copyright (c) 2014 pezy. All rights reserved.
//
#include "ex7_06.h"
int main()
{
Sales_data total;
if (read(std::cin, total))
{
Sales_data trans;
while (read(std::cin, trans)) {
if (total.isbn() == trans.isbn())
total.combine(trans);
else {
print(std::cout, total) << std::endl;
total = trans;
}
}
print(std::cout, total) << std::endl;
}
else
{
std::cerr << "No data?!" << std::endl;
return -1;
}
return 0;
}