![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 02.04.2021 21:10 oscargonzalez4310
Library book sorting
Two sorted lists have been created, one implemented using a linked list (LinkedListLibrary linkedListLibrary) and the other implemented using the built-in Vector class (VectorLibrary vectorLibrary). Each list contains 100 books (title, ISBN number, author), sorted in ascending order by ISBN number.
Complete main() by inserting a new book into each list using the respective LinkedListLibrary and VectorLibrary InsertSorted() methods and outputting the number of operations the computer must perform to insert the new book. Each InsertSorted() returns the number of operations the computer performs.
main. cpp
#include "LinkedListLibrary. h"
#include "VectorLibrary. h"
#include "BookNode. h"
#include "Book. h"
#include
#include
using namespace std;
void FillLibraries(LinkedListLibrary &linkedListLibrary, VectorLibrary &vectorLibrary) {
ifstream inputFS; // File input stream
int linkedListOperations = 0;
int vectorOperations = 0;
BookNode* currNode;
Book tempBook;
string bookTitle;
string bookAuthor;
long bookISBN;
// Try to open file
inputFS. open("books. txt");
while(getline(inputFS, bookTitle)) {
inputFS >> bookISBN;
inputFS. ignore(1, '\n');
getline(inputFS, bookAuthor);
// Insert into linked list
currNode = new BookNode(bookTitle, bookAuthor, bookISBN);
linkedListOperations = linkedListLibrary. InsertSorted(currNode, linkedListOperations);
linkedListLibrary. lastNode = currNode;
// Insert into vector
tempBook = Book(bookTitle, bookAuthor, bookISBN);
vectorOperations = vectorLibrary. InsertSorted(tempBook, vectorOperations);
}
inputFS. close(); // close() may throw ios_base::failure if fails
}
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 08:30
Today is the anniversary of me being on yet, i don't need it anymore! here's a picture of my dog wearing a bowtie! my question is, how do i delete my account?
Answers: 1
![question](/tpl/images/cats/informatica.png)
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 20:00
How is the number 372 written when expanded out to place values in the base 8 (octal) number system? a. 2 x 4 + 3 x 2 + 4 x 1 b. 3 x 64 + 7 x 8 + 2 x 1 c. 3 x 8 + 7 x 7 + 2 x 6 d. 3 x 100 + 7 x 10 + 2 x 1
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
You know the right answer?
Library book sorting
Two sorted lists have been created, one implemented using a linked list (Linke...
Questions
![question](/tpl/images/cats/mat.png)
Mathematics, 13.10.2020 01:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 13.10.2020 01:01
![question](/tpl/images/cats/health.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 13.10.2020 01:01
![question](/tpl/images/cats/mat.png)
Mathematics, 13.10.2020 01:01
![question](/tpl/images/cats/mat.png)
Mathematics, 13.10.2020 01:01
![question](/tpl/images/cats/mat.png)
Mathematics, 13.10.2020 01:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 13.10.2020 01:01
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
English, 13.10.2020 01:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/health.png)
Health, 13.10.2020 01:01