Question: USING C++ Activities Activities in this lab are a continuation of the previous labs. So, make sure that your code from previous labs is complete
USING C++
Activities
Activities in this lab are a continuation of the previous labs. So, make sure that your code from previous labs is complete and running flawlessly.
Declare a vector of type Asset called libDB (library database). Inside your program, open the file input.txt then in a loop do the following:
Read a line from the file
Declare a temporary variable of type Asset called ast
Parse the line that you read from the file and fill out the fields of this struct using the
information from the line.
Push the temporary variable ast inside the vector libDB.
Do these operations till you reach the end of the file.
Note: Every line of the input.txt file contains information related to one asset of the library. As an example, lets have a look at the first line:
book;Introduction to C++;James Smith,Jane Smith;1998;1234AB;8888;20;5; It contains several fields of information that are separated by semicolons (;). These fields are as follows:
Asset type: book
Asset title: Introduction to C++
Authors: James Smith,Jane Smith
Note that this asset has two authors, and the names of authors are separated by commas (,)
Year of publication: 1998
ISBN: 1234AB
Library ID: 8888
Total number of assets on record: 20
Available number of assets: 5
The string finishes with a semicolon (;) in the end.
INPUT FILE:
book;Introduction to C++;James Smith,Jane Smith;1998;1234AB;8888;20;5; DVD;History of Kuwait;Abdullah AlJarallah,Nasser Hakim;1990;5678CD;9999;10;4; magazine;Men's Health;Scott Atkins;2005;9879EF;10234;25;10; book;Children's Stories;John Smith;2020;8878GFD;113223;30;20;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
