1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gayaneshka [121]
3 years ago
9

Create a linked list for library patrons. Put at least 8 patrons in the list. (You should hard code this data.) Ask for a person

's name. Tell if the person is in the list or not. If the person is in the list, show the person's information. Data fields are: Name, Library card number, Street, City, Zip
Computers and Technology
1 answer:
Evgesh-ka [11]3 years ago
7 0

Answer:

Explanation:

#include <bits/stdc++.h>

using namespace std;

/* Link list node */

class Node

{

public:

string Name;

long Library_card_number;

string Street;

string City;

long Zip;

Node* next;

};

/* Given a reference (pointer to pointer) to the head

of a list and an int, push a new node on the front

of the list. */

void push(Node** head_ref,string name,long lcn,string street,string city,long zip)

{

/* allocate node */

Node* new_node = new Node();

/* put in the key */

new_node->Name = name;

new_node->Library_card_number = lcn;

new_node->Street = street;

new_node->City = city;

new_node->Zip = zip;

/* link the old list off the new node */

new_node->next = (*head_ref);

/* move the head to point to the new node */

(*head_ref) = new_node;

}

/* Checks whether the value x is present in linked list */

Node* search(Node* head, string x)

{

Node* current = head; // Initialize current

while (current != NULL)

{

if (current->Name == x)

return current;

current = current->next;

}

return NULL;

}

/* Driver program to test count function*/

int main()

{

/* Start with the empty list */

Node* head = NULL;

int x = 21;

/* Use push() to construct below list

14->21->11->30->10 */

push(&head, "Joe",1,"hippy Street","Bay area",2009);

push(&head, "Marie",2,"lippy street","san jose",2010);

push(&head, "Harry",3,"gippy Street","Bay area",2009);

push(&head, "Ashish",4,"dippy street","san jose",2010);

push(&head, "Zuck",5,"sippy Street","Bay area",2009);

push(&head, "Gates",6,"kippy street","san jose",2010);

push(&head, "Page",7,"pippy Street","Bay area",2009);

push(&head, "Brin",8,"dippy street","san jose",2010);

string name;

cout<<"Enter name of the person to search: ";

cin>>name;

Node* z = search(head,name);

if(z!=NULL){

cout<<"\nPerson found in the list"<<endl;

cout<<"Name: "<<z->Name<<endl;

cout<<"Library Card Number: "<<z->Library_card_number<<endl;

cout<<"Street: "<<z->Street<<endl;

cout<<"City: "<<z->City<<endl;

cout<<"Zip: "<<z->Zip<<endl;

}else{

cout<<"No person found with the name "<<name<<endl;

}

return 0;

}

You might be interested in
Zeke used primarily Web sources for his informative speech about gun control. However, his over-reliance on the website sponsore
Andreas93 [3]

Answer:

a. Objectivity

Explanation:

Zeke ignored objectivity as a criteria for evaluating Web sources.

7 0
3 years ago
Which of the following is the best example of an installation issue
Tasya [4]

Answer:

A user made an error while trying to set up a software program.

6 0
3 years ago
Read 2 more answers
Why could Mars not hold onto its atmosphere?
vazorg [7]

Answer:

Mars loses its atmosphere faster, because there's less gravity to hold on to it. It goes through the loss of atmosphere faster than earth does

Explanation:

3 0
3 years ago
What are the basic steps in creating a new program
ladessa [460]
<span>first make a text file, then write the framework or(scripts for your program). Then write Your Instruction and save Your Program. After you've done that, get and install java jdk(its like a development tool). Finally c<span>opy the path(text file) to the Java tools(jdk)

</span></span>
3 0
3 years ago
Assuming we do not use recursion, why is a loop necessary to find an arbitrary node in a linked list
anastassius [24]

Answer:

We cannot access nodes in the linked list directly.

Explanation:

In linked list we cannot access nodes directly like arrays.In arrays we have index for the direct access to the element.So we have to iterate over the linked list and search for the node one by one.Since we are not using any recursion so we have to use loop to iterate over the linked list.

4 0
4 years ago
Other questions:
  • Define the following term: - hue
    11·2 answers
  • Ryan is looking at investment opportunities as a cloud service provider. He wants to invest in a deployment-based cloud model th
    11·2 answers
  • Your supervisor has asked you to help with the orientation of three new office employees. Topics you're asked to present include
    9·1 answer
  • The ____ tool allows a user to connect to the active registry database and make changes that are effective immediately. editreg.
    12·1 answer
  • Your supervisor has asked you to set up a RAID hard drive array in a tower system, which has a motherboard that uses the B360 ch
    10·1 answer
  • The loss of privacy data has implications:
    5·1 answer
  • ⇒PLEASE HELP ME!!!!!!!!∧_∧
    15·2 answers
  • Which of the following kinds of computing refers to an environment of servers that house and provide access to resources users a
    5·1 answer
  • What is the answer ????​
    5·1 answer
  • 9- Write a program in MARIE to add three numbers.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!