Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help on this please! c++ HW_4-1b Write a program that creates a linked list of Dogs. 2 Files: Dog.h and Source.cpp Create a new

need help on this please! c++ image text in transcribed
image text in transcribed
image text in transcribed
HW_4-1b Write a program that creates a linked list of Dogs. 2 Files: Dog.h and Source.cpp Create a new project and name it: Linked List insert Dog / OUTPUT Enter dogs into the list Bad Description: Create a linked list of Dogs. Each node is an object of struct Dog. o Each Dog object has these three variables: id (int) name_(string) *next (a pointer of Dog data type) Place your struct Dog in a header file named: Dog.h In main.cpp, use a while loop to create a linked list of Dog objects. Insert at least 3 dogs into a linked list. - to quit the loop ID: 100 user enters 100 Name: user enters Enter another dog XY ON)? /* User enters y 30 the while loop continues and another dog is entered into the list. / Display the list (Y/N)? // -- sereen cleans - Here is the list "displaytist) o ID: 103 Nam Red ID: 102 Name: Spot IDE 101 Name: Big Boy ID: 100 Name: Hud . . o With each iteration do the following: Ask the user for a Dog's name. I Read in the name Call a function named: insertDog() The function is a void-returning function Pass the head pointer to the function The function created a new Dog object . // Now delete a dog Enter an ID of a dog to be deleted: 101 The dog has been deleted. (or) Enter a dog to be deleted: 105 105 is not in the list. Here in the list after the delete . . Here is the listi In main.cpp, use a while loop to create a linked list of Dog objects. o Insert at least 3 dogs into a linked list. to quit the loop displaylist ID: 103 Nam: Red ID: 102 Name: Spot ID: 101 Name: Big Boy ID: 100 Name: Bud . . // Now delete a dog Enter an ID of a dog to be deleted: 101 The dog has been deleted. (or) o With each iteration do the following: Ask the user for a Dog's name. Read in the name Call a function named: insertDog() The function is a void-returning function. Pass the head pointer to the function. The function created a new Dog object Assign the name to the new object. Connect the new object to the list. Enter a dog to be deleted: 105 105 is not in the list. Here is the list after the delete deleteDogo ID: 103 Name Red ID: 102 Name: Spot ID: 100 Name Bud After creating a list of at least 3 Dogs. clear the screen. Prompt the user if he or she wishes to see the list. o If yes, then call displayList() to display the list. Then clear the screen. Finally, call a delete List() function. o 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 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

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

=+ 4. How can policymakers infl uence a nations saving rate?

Answered: 1 week ago