C How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
8th Edition
ISBN: 9780134227023
Author: Paul J. Deitel; Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 12, Problem 12.8E
Program Plan Intro
Program plan:
- Item, start variablesare used for input. There is structure listnode having data, nextPtr member variables which represents the linked list node.
- void insert(node **head, int value) function inserts the node in the a linked list.
- void calculate (node *flist) functioncalculate the sum of the contents of the linked list and then calculate the average value and display the result.
- void printList(node *head) function display the contents of the linked list.
Program description:
The main purpose of the program is to create linked list of 25 values which are generated randomly. Then sum and average of these values are calculated and displayed.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Summing and Averaging Elements in a List) Write a program that inserts 25 random integers from 0 to 100 in order in a linked list object. The program should calculate the sum of the elements and the floating-point average of the elements.
(Online Address Book revisited) Programming Exercise 5 in Chapter 11 could handle a maximum of only 500 entries. Using linked lists, redo the program to handle as many entries as required. Add the following operations to your program:
Add or delete a new entry to the address book.
Allow the user to save the data in the address book.
4
Chapter 12 Solutions
C How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
Ch. 12 - Prob. 12.6ECh. 12 - (Merging Ordered Lists) Write a program that...Ch. 12 - Prob. 12.8ECh. 12 - (Creating a Linked List, Then Reversing Its...Ch. 12 - Prob. 12.10ECh. 12 - Prob. 12.11ECh. 12 - Prob. 12.12ECh. 12 - Prob. 12.13ECh. 12 - Prob. 12.14ECh. 12 - (Supermarket Simulation) Write a program that...
Knowledge Booster
Similar questions
- - Question-2: Functions, Iterations and List • Write a function that takes a positive integer n as its parameter. • Return a list whose o values are numbers between n and 2n.arrow_forward(Attach Python file only) Write a program that does the following 1- Declare the list my_list that has the following integer numbers 6, 5, 1, -3, 10, 0, and 4 as items of the list. 2- Modify the value of list items based on the following If the item of the list is an integer and less than three, increment its value by 2. If the item of the list is an integer is greater than or equal to three, decrement its value by 3. 3- after modification, print out the items of the list that have only the even index in the reverse order. A- В I T Ff ♥ = E E E !arrow_forward5- Write a python program that takes 5 positive integers from the user and prints the list after removing even numbers from that list. (Don't use built-in functions)arrow_forward
- Write the following function that returns true if the list is already sorted in increasing order: bool isSorted(const int list[], int size) Write a test program that prompts the user to enter a list and displays whether the list is sorted or not. Here is a sample run. Note that the first number in the input indicates the number of the elements in the list. This number is not part of the list. Assume the maximum list size is 80.arrow_forwardscheme: Q9: Sub All Write sub-all, which takes a list s, a list of old words, and a list of new words; the last two lists must be the same length. It returns a list with the elements of s, but with each word that occurs in the second argument replaced by the corresponding word of the third argument. You may use substitute in your solution. Assume that olds and news have no elements in common. (define (sub-all s olds news) 'YOUR-CODE-HERE )arrow_forwardAlert - don't use AIarrow_forward
- Use c++ Write a program that uses the STL list container to create a linked list of integers. The program will ask the user to provide a list of integers. When the user is finished, the program will list the integers entered by the user and show the average of those integers. Additionally, you need to add the following code: Display your name (first and last) before you ask the user to enter the integers. You need to do one of the followings: (do not do all three) if the first letter of your last name is between and including A through G, compute the maximum value entered by the userarrow_forward# Reverse the order of elements in the list y [18, 5, 2, 4] print(y) Complete the code to return the output [4, 2, 5, 18] Fill in the blanks reverse (A invert (B (invert (C (reverse. (D)arrow_forward(True/False): Arrays are passed by reference to avoid copying them onto the stackarrow_forward
- (Algebra: perfect square ) Write a program that prompts the user to enter an integer m and find the smallest integer n such that m * n is a perfect square. (Hint: Store all smallest factors of m into an array list. n is the product of the factors that appear an odd number of times in the array list. For example, consider m = 90, store the factors 2, 3, 3, 5 in an array list. 2 and 5 appear an odd number of times in the array list. So, n is 10.) Sample Run 1 Enter an integer m: 1500 The smallest number n for m x n to be a perfect square is 15 m x n is 22500 Sample Run 2 Enter an integer m: 63 The smallest number n for m x n to be a perfect square is 7 m x n is 441 Class Name: Exercise11_17 Answer is : import java.util.Scanner; public class Squares { public static void main(String[] args) { Scanner scan = new Scanner(System.in); //instantiation of Scanner that will take inputs from the keyboard //the try catch block below is for trapping error with the input try {…arrow_forwardWrite the following function that returns true if the list is already sorted in increasing order:def isSorted(lst):Write a test program that prompts the user to enter a list and displays whether the list is sorted or not.arrow_forwardDo the whole program in C++ & Please kindly share the whole programarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning