1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
int main() {
Book b2(12, "Wheel of Time", "Robert Jordan", "TOR", 20.00, 400);
b2.display ();
cout<<endl<<endl;
int i, pg;
string n;
string a;
string p;
float pr;
cout<<"Please enter the Book Information: "<<endl;
cout<<"ISBN: "<<endl;
cin>>i;
cout<<"Name of Book: "<<endl;
cin>>n;
cout<<"Author: "<<endl;
cin>>a;
cout<<"Publisher: "<<endl;
cin>>p;
cout<<"Price: ";
cin>>pr;
cout<<"Pages: "<<endl;
cin>>pg;
Book b3(i,n,a,p,pr,pg);
ofstream outFile;
outFile.open("Book.txt",ios::out| ios::app);
outFile.write((char*)&Book(i,n,a,p,pr,pg),sizeof(Book(i,n,a,p,pr,pg)));
outFile.close();
ifstream inFile("Book.txt",ios::in);
inFile.read((char*)&Book(i,n,a,p,pr,pg),sizeof(Book (i,n,a,p,pr,pg)));
inFile.close();
} // End Main
|