Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with Linked list for data structures with c++: Write a C++ program to implement a singly linked list of books. The book details should

Help with Linked list for data structures with c++:

Write a C++ program to implement a singly linked list of books. The book details should include the following: title, author, and ISBN. The program should include the following functions:

*addBook: This is a function to add a new book to the list.

*isInList: This is a function to check if a book exists in the list.

*compareLists: This is a function to check whether two lists have the same books.

The user should be allowed to chose and enter this information. I need help completing this program.

My current code:

#include

using namespace std;

struct node

{

int data;

node *next;

};

class linked_list

{

private:

node * head, *tail;

public;

linked_list()

{

head = NULL;

tail = NULL;

}

void addBook(int b)

{

node *tmp = new node;

tmp->data = b;

tmp->next = NULL;

if (head == NULL)

{

head = tmp;

tail = tmp;

}

else

{

tail->next = tmp;

tail = tail->next;

}

}

};

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

Students also viewed these Databases questions

Question

D How will your group react to this revelation?

Answered: 1 week ago

Question

dy dx Find the derivative of the function y=(4x+3)5(2x+1)2.

Answered: 1 week ago

Question

Draw and explain the operation of LVDT for pressure measurement

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

2. What type of team would you recommend?

Answered: 1 week ago