Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Code in c++. HW 4b Write a program that creates a linked list of Dogs Create a new project and name it: Linked_List 2 Files:

Code in c++. image text in transcribed
HW 4b Write a program that creates a linked list of Dogs Create a new project and name it: Linked_List 2 Files: Dog.h and main.cpp insertDog Description: Create a linked list of Dogs .Each node is an object of struct Dog. OUTPUT Enter dogs into the list: 100 o Each Dog object has these three variables: me: Bud user enters 100 user enters . id (int) Enter another dog (Y or N)? y name (string) /. User enters y, so the while loop continues and another dog is entered into the list. next (a pointer of Dog data type) .Place your struct Dog in a header file named: Dog.h Display the list (Y/N)? y /screen clears-- Here is the list: In main.cpp, use a while loop to create a linked list of Dog objects. .to quit the loop With each iteration do the following: ID: 103 Name: Red ID: 102 Name: Spot ID: 101 Name: Big Boy ID: 100 Name: Bud o Insert at least 3 dogs into a linked list displayList) o Ask the user for a Dog's name. - Read in the name. . Call a function named: insertDog0 // Now delete a dog Enter an ID of a dog to be deleted: 101 The dog has been deleted. The function is a void-returning function. . Pass the head pointer to the function. or) . The function created a new Dog object Enter a dog to be deleted: 105 Assign the name to the new object. Connect the new object to the list. 105 is not in the list Here is the 1ist after the delete: ID: 103 Name: Red ID: 102 After creating a list of at least 3 Dogs, clear the screen. deleteDog Prompt the user if he or she wishes to see the list. Name: Spot ID: 100 o If yes, then call displayList0 to display the list. Name : Bud . Then clear the screen. Finally, call a deleteList0 function. The function prompts the user to enter an ID. o Then the function uses while loop to go through the list to find the ID. o If the ID is in the list, the dog is deleted. o If not in the list, output that the ID was not found

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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