7.7
//2018年8月17日 练习7.7
Sales_data total;
if (read(cin, total)) {
sales_data trans;
while (read(cin, trans)) {
if (total.isbn() = trans.isbn()) {
total.combine(trans);
}
else {
print(cout, total) << endl;
}
}
print(cout, total) << endl;
}
else {
cerr << "no data?" << endl;
}
7.9
#include "stdafx.h"
#include "iostream"
#include "stddef.h"
#include "string"
#include<vector>
using namespace std;
//2018年8月17日 练习7.7
class person {
private:
string name;
string address;
public:
istream &read(istream &is, person &item)
{
is >> item.name >> item.address;
return is;
}
ostream &print(ostream &os, const person &item)
{
os << item.name << item.address;
return os
}
};
7.11
//2018年8月17日 练习7.7
class sales_data {
public:
sales_