Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP! This question is so confusing. Please help and explain! I will give thumbs up! THANKS!!! Q6: Save and Load Functions (Using ifstream &

PLEASE HELP! This question is so confusing. Please help and explain! I will give thumbs up! THANKS!!!

image text in transcribed

image text in transcribed

Q6: Save and Load Functions (Using ifstream & ofstream) (20 points) // Q6a: saveDatabase() // Save the linked list of books to a file DB.txt using ofstream. I/You will need to come up with a way to store the number of members in linked list. That will help in load(). //One way to store is: // // // //KLibrary number of book1> // //knoOfBooks of book2> // // Hint: You may want to cast the enum 'Library' to an int before writing it to the file. // saveDatabase() is already called when exiting the program. You do not need to call it anywhere else. DB-Notepad File Edit Format View Help 3Computer Organization Algorithm Design intro to java This is one example of how to save the database in DB.txt. The '3' at the beginning is the number of books in the database. This number might be of help when implementing loadDatabase(). This file does not need to have very neat presentation because the file is not meant for the user to see. You may use a different format to save.) 7 l Page CSE220 Programming for Computer Engineering Project 06 le: MainClass.cpp (10 points) // Q6b: loadDatabase() // Load the linked list of books from DB.txt using ifstream. // You will need to create the linked list in the same order that is was saved to the file // You will need to create a new node for the linked list, then add it to the tail of the list. // Hint: If you casted the enum Library' to an int, you will need to cast it back to a 'Library // You will use the 'Library' variable read from the file to determine which constructor to use // loadDatabase() is already called at the beginning of main(). You do not need to call it anywhere else // During the very first execution, there will be no DB.txt in source directory. DB.txt is generated by saveDatabase() while exiting the program. Q6: Save and Load Functions (Using ifstream & ofstream) (20 points) // Q6a: saveDatabase() // Save the linked list of books to a file DB.txt using ofstream. I/You will need to come up with a way to store the number of members in linked list. That will help in load(). //One way to store is: // // // //KLibrary number of book1> // //knoOfBooks of book2> // // Hint: You may want to cast the enum 'Library' to an int before writing it to the file. // saveDatabase() is already called when exiting the program. You do not need to call it anywhere else. DB-Notepad File Edit Format View Help 3Computer Organization Algorithm Design intro to java This is one example of how to save the database in DB.txt. The '3' at the beginning is the number of books in the database. This number might be of help when implementing loadDatabase(). This file does not need to have very neat presentation because the file is not meant for the user to see. You may use a different format to save.) 7 l Page CSE220 Programming for Computer Engineering Project 06 le: MainClass.cpp (10 points) // Q6b: loadDatabase() // Load the linked list of books from DB.txt using ifstream. // You will need to create the linked list in the same order that is was saved to the file // You will need to create a new node for the linked list, then add it to the tail of the list. // Hint: If you casted the enum Library' to an int, you will need to cast it back to a 'Library // You will use the 'Library' variable read from the file to determine which constructor to use // loadDatabase() is already called at the beginning of main(). You do not need to call it anywhere else // During the very first execution, there will be no DB.txt in source directory. DB.txt is generated by saveDatabase() while exiting the program

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago

Question

Understand the role of corporate design in communications.

Answered: 1 week ago