c++primer第五版习题8.6,大家看看错在哪了?
#include<iostream>#include<fstream>
#include<string>
#include<vector>
#include<cstdlib>
#include"Sales_Date.h"
using namespace std;
int main(void)
{
Sales_Date total;
ifstream op_File("haibo.txt",ios::in|ios::out);
char line[100];
if(!op_File) cout << "error!";
op_File.getline(line,100);
if(read(cin>>line,total))
{
Sales_Date trans;
op_File.getline(line,100);
while(read(cin>>line,trans))
{
op_File.getline(line,100);
if(total.isbn() == trans.isbn())
(trans);
else total = trans;
}
print(cout,total) << endl;
}
else {cerr << "error!\n";}
op_File.close();
system("pause");
return 0;
}