Print out a line stating that the value sought was found

Assignment Help Computer Engineering
Reference no: EM132208360

Write a program in C that does the following:

a) Builds a simple linked list consisting of 100 nodes each of which contains a random integer between 50 and 100, inclusive. The list is to be built in main() and must be a local variable in main().

b) Include a programmer-defined function in the same program as item 1 above named printout(arg) that takes in the head pointer of the already-built linked list as an argument and prints out the contents of the linked list to the screen, starting from the head of the list to the tail. See the output below.

Node #0 contains 53 Node #1 contains 78 Node #2 contains 95
.
Node #20 contains 100

c) Include a programmer-defined function in the same program as item 1 above called sum() that adds up the contents of the data members of each node in the list, and prints out the total as follows:
The sum total of all nodes in this list is <whatever the sum total is>

d) Include a programmer-defined function in the same program as item 1 above called reverse(arg) that takes in the head pointer of the already-built linked list as an argument and will physically reverse the order of the nodes in the list (i.e., the new head will be the old tail and the new tail will be the old head of the list). Use the function printout() to print out its contents now that it is reversed order. This does NOT mean that it will be read backwards, but rather, the now-reversed list will be read from head to tail!

e) Write a programmer-defined function called search(arg) that asks the user what number (between 50 and 99) she wishes to find in the linked list. The function searches for that number in the linked list and if found, prints out the position of the node in which it found the number requested. If the number requested is not within the proper range (50 to 99), then say so and give the user a second chance to enter it. If it is within the range, but it is not found, it should say that the search could not find that number in the list.

Set up the user entry in a loop so that the user can enter numbers repeatedly if she wants. That is, when the number is found (or not found), it will give her an opportunity to enter a new number. If the user no longer wants to use the program, she should enter -1.

For output, print out a line stating that the value sought was found in the nth node. For example:

Please enter the number to be sought in the list: >> 15 The number 15 was found in node #78

Note: The program submitted shall have all those functions described above and will execute them. The reason they are listed separately is that credit will be distributed among these functions.

Reference no: EM132208360

Questions Cloud

Prompts the user for a number of seconds and then converts : Write a program in C that prompts the user for a number of seconds and then converts it to h:m:s format.
Compare the performance of merge sort and quick sort : Write a program (C++ or Java) that compares the performance of the following sorting algorithms: Merge sort, Quick sort
Print out the contents of the array to the screen : Make an array of structure instances, where each instance has two members: 1) a string with a name; and 2) an integer value between 0 and 100.
Write a program that divides by a multiple of 2 in a binary : Write a program in C++ that divides by a multiple of 2 in a binary number. Create an array, called num1 of characters, 10 chars long.
Print out a line stating that the value sought was found : Builds a simple linked list consisting of 100 nodes each of which contains a random integer between 50 and 100, inclusive.
What is the project risk adjusted rate of return : Zacher Co.'s is going to implement a project to expand its shipping operations. The project has a beta of 1.40, the risk-free rate is 4.25%.
What kinds of assumptions underlie the rosy scenario : The Trustees of the Social Security Administration produce three different sets of estimates: low-cost, high-cost and intermediate.
Compare the efficiency and equity consequences : Consider the following (hypothetical) liability rule. The injurer will be held strictly liable for any damages that the victim suffers.
Why was the chilean sea bass almost driven to extinction : The Patagonian toothfish is a large, ugly fish that can weigh 200 pounds. In the 1990s, it became very popular under its new name, the Chilean sea bass.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd