Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[C++ Code] Reading from a file to an object, then storing it in an array So I have a class, Book, as shown below. My

[C++ Code] Reading from a file to an object, then storing it in an array

So I have a class, Book, as shown below. My question is how do I read from a file called input.data to create a Book object from each line (see example input.dat below)? As each Book object is created, how do I store it in an array of the type Book.

image text in transcribed

Example input.dat

000001, Bjarne Stroustrup, The C++ Programming Language, 4, 2013, 0321563840

000002, Stephen Colbert, Stephen Colbert's Midnight Confessions, 1, 2017, 1501169009

000003, Tom Clancy, The Hunt for Red October, 2, 1984, 0425240339

000004, Gregory Dudek, Computational Principles of Mobile Robotics, 2, 2010, 0521692121

class Book t public: Book (); Book(string id, string auth, string tit, int ed, int yr, string isbn); private: string book_id; string author; string title; int edition; int pub_year; string ISBN

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago