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

  Create program that reads from the external file input.txt

create a program that reads from the external file input.txt

  Write c code to repeatedly ask the user for a number

Write C code to repeatedly ask the user for a number, then once the user enters 0, the code displays the min, max and average of all values entered.

  Write a shell script that takes a file name as a parameter

Write a shell script that takes any command as a parameter and displays help on that command (e.g. the result of execution of man ).

  Should the associates perform a post-implementation

Prepare 10 FAQs and answers for use in the printed user manual and context-sensitive Help screens.

  Credit scorecards are used by banks and financial

credit scorecards are used by banks and financial institutions to determine whether applicants will receive loans. the

  How to process all entries in the dictionary

How to process all entries in the dictionary if you decide to use something other than the key to search it.

  How many cycles per second does the processor spend

How many cycles per second does the processor spend handling interrupts and processing requests from the device?

  Develop a site structure diagram using word

Develop a site structure diagram using Word, PowerPoint or any other tool that you feel comfortable with. The top level of hierarchy should only show home page.

  What selection criteria would you use

Outline a process for Homestyle to follow in order to decide between the two software options (i.e., HC and CR)? What selection criteria would you use?

  Write a function that converts an input of some integer

Write a function that converts an input of some integer number of nickels into outputs of integer numbers of dollars, quarters, and nickels. Do not write a main function. Your function does not do cin or cout.

  How would the erd be changed to incorporate the design

How would the following ERD be changed to incorporate the design decision listed next? The analyst wants to keep track of the user ID of anyone who changes a grade for a course.

  Derive the circuit diagram for a bcd counter

Derive the circuit diagram for a BCD counter that counts from 0 through 9 (and returns to 0) using clocked SR flip-flops. The counter increments only when.

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