Computers and Technology

Goals: Create your own linked list.
Perform basic linked list operations.
Requirements:
Write a program that implements and demonstrates a linked list using functions. Your program should first define a node that stores an integer and then your program will include the following functions:
append() - This function accepts the head pointer (by reference) of a linked list and an integer as it's only arguments. It then creates a node, stores the integer argument in the node, and adds it to the end of the list.
find() - This function accepts the head pointer (by value) of a linked list and an integer to search for in the list as it's only arguments. It then searches the list for the first occurrence of the integer argument. If it finds it, it returns true. If it doesn't, it returns false.
clear() -- This function accepts the head pointer of a linked list (by reference) as it's only argument. It then removes all the nodes of the linked list from memory by deleting them one at a time. The function leaves the head pointer set to nullptr.
print() - This function accepts the head pointer of a linked list (by value) as it's only argument and then displays on the screen all the integers stored in the list.
Demonstrate your functions by adding 5 numbers to the linked list. Then, print the list. Then search the list for a value and then indicate the result. Finally, print the list one last time.
The only functions that interact with the user is the print() function (and main()). No other functions contain cin or cout statements.
Use the posted algorithms on Canvas to guide you. You need merely translate them to C++. Translating the pseudocode into C++ is a major portion of the assignment! The previous labs have included sample pseudocode to prepare you for this. If you skipped the labs, well, you may be in trouble.
The sample code in the text will be of very little use. The sample code in chapter 17 is based on classes which are not covered in this course. if your solution includes classes, I will give you 0 points for your submission. I'm asking you to write functions, not classes.
Notes:
Your solution will receive major penalties for memory leaks.
This assignment is a "capstone" assignment where you will demonstrate your accumulated knowledge over the semester.
A 20-Point Sample Run:
The first line contains all the integers of my list after appending them.
The second line is the result of my find function searching for 68.
Hints:
Make sure you understand pointers and dynamic memory allocation.
Write your print() function first, it will help in testing.
Write one function at a time.
Use hand-tracing to hunt down any errors.
If your program crashes, it is almost certainly because you are dereferencing an invalid memory location which is the result of a logic error.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:20, codie1103
This os integrated the processing power of windows nt with the easy-to-use gui of windows 98. windows 2000 windows 3.11 windows for workgroups windowa millennium edition
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, HannahVance99
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
image
Computers and Technology, 23.06.2019 11:00, swelch2010
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
image
Computers and Technology, 23.06.2019 17:00, Alexaisokay1
In which of the following ways can using test-taking tips you? a. you can focus on the information that you need to study. b. you will see the answers to the test. c. you will study more. d. you will be less organized.
Answers: 1
Do you know the correct answer?
Goals: Create your own linked list.
Perform basic linked list operations.
Requirements:...

Questions in other subjects:

Konu
Mathematics, 21.02.2022 14:00