// 编写程序,读取多个具有相同的ISBN的销售记录,输出所有记录的和。
#include<iostream>
#include"Sales_item.h"
int main()
{
Sales_item total, trans;
std::cout << "请输入几条ISBN相同的销售记录: " << std::endl;
//判断是否为相同的ISBN
if (std::cin >> total) //读取第一条销售记录
{
while (std::cin >> trans) //读取剩下的销售记录
//判断这两条记录是否相同
if (compareIsbn(total, trans))
total += trans;
else //ISBN不同
{
std::cout << "ISBN不同 " << std::endl;
system("pause");
return -1;
}
std::cout << "汇总信息: ISBN、销售本数、销售额和平均售价为 " << total << std::endl;
}
else //输入错误
{
std::cout << "没有数据" << std::endl;
system("pause");
return -1;
}
system("pause");
return 0;
}