int main()
{
Book book[maxx];
std::ifstream infile;
std::string line;
infile.open("books.dat");
if( infile.fail() )
cout<<"\nFile not found!\n";
else
{
while ( std::getline(infile,line)) /// you read first line here
{
for(int i=0;i<maxx;i++)
{
book[i].readFile(infile); /// then you read second line
/// the >> operator reads to space
/// and puts data in first variable if it can
/// the >> reads next data to space
/// and puts data into second variable
/// etc
book[i].gradeAge();
book[i].displayResult();
}
infile.close();
system("pause");
return 0;
}
}