#include <iostream>
//#include <string>
#include "Sales_data.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main()
{
cout << "输入数据(ISBN、销售量、原价、实际售价):" << endl;
Sales_data total;
if (cin >> total.bookNo >> total.units_sold >> total.revenue)
{
Sales_data trans;
while(cin >> trans.bookNo >> trans.units_sold >> trans.revenue)
{
if (total.bookNo == trans.bookNo)
{
total.units_sold += trans.units_sold;
total.units_sold += trans.revenue;
}
else
{
cout << total.bookNo <<" " << total.units_sold << " " << total.revenue << " " << endl;
total = trans;
}
}
cout << total.bookNo <<" " << total.units_sold << " " << total.revenue << " " << endl;
}
else
{
cerr << "No data ?!" << endl;
return -1;
}
return 0;
}