Question: Please create an Array of books in C++ program. In Bookclass.cpp file create an array of books (size 6) Write a loop to read in
Please create an Array of books in C++ program.
In Bookclass.cpp file create an array of books (size 6)
Write a loop to read in the book data from Books.txt. Instantiate a book based on each line, and add that into the books array.
Books.txt
Title Author ISBN Price
Once_Upon_A_Time New_Author 1234323456787 25.00
Midnight_Moon Margaret_Brown 3456789765432 50.00
A_Wrinkle_In_Time Madeline_Engle 2535483215987 60.00
Harry_Potter J_K_Rowling 0002569854712 100.00
Charlottes_Web E_B_White 036250125478 25.00
The_Snowy_Day Ezra_Keats 00025523148 50.00
Pseudo code:
// set an index counter to zero int i=0;
// while not eof
/// read data for one line into variables
/// instantiate a book using your overloaded constructor
/// put the instantiated book into the books array books[i] = b
/// increment i
/// loop
Then loop through the array of books using the for range loop, and output just the authors to the console.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
