Program that generates a new list

Assignment Help C/C++ Programming
Reference no: EM13907638

Given a list listA of numbers, write a program that generates a new list listB with the same number of elements as listA, such that each element in the new list is the average of its neighbors and itself in the original list. For example, if listA = [5, 1, 3, 8, 4], listB = [3.0, 3.0, 4.0, 5.0, 6.0], where the values in listB were computed as follows:

(5 + 1)/2 = 3.0
(5 + 1 + 3)/3 = 3.0
(1 + 3 + 8)/3 = 4.0
(3 + 8 + 4)/3 = 5.0
(8 + 4)/2 = 6.0

listA can be hardcoded at the begining of your program, but the solution should work for other lists as well (in particular if we modify the values of the list, the program should work with the new values).

Sample run:

listA = [5, 1, 3, 8, 4]

listB = [3.0, 3.0, 4.0, 5.0, 6.0]

Reference no: EM13907638

Questions Cloud

What are the sales objectives for new sales representative : What are the sales objectives for the new sales representative? What role will the compensation design play in motivating the new sales representative? What kind of sales incentive plan do you recommend? Why
What other dbms constructs came after relational databases? : What other DBMS constructs came after relational databases?
Kenya company standard cost accounting system recorded : Kenya Company's standard cost accounting system recorded this information from its June operations.
Compute the sum of the first : Assume there is a variable , h already associated with a positive integer value. Write the code necessary to compute the sum of the first h perfect squares, starting with 1 .
Program that generates a new list : Given a list listA of numbers, write a program that generates a new list listB with the same number of elements as listA, such that each element in the new list is the average of its neighbors and itself in the original list. For example, if listA..
Write an sql drop statements that will drop the all tables : Write an SQL DROP statements that will drop the all tables. Add these statements to the appropriate location within the script file - Write a SQL CREATE TABLE statement to create the ALLOCATION table. Add the SQL statement to the appropriate locati..
Analysis of flexible budgets and standard costs emphasizes : Analysis of flexible budgets and standard costs emphasizes the importance of a similar unit of measure for meaningful comparisons and evaluations.
Program that loads the keywords and definitions : 1) Develop the part of the program that loads the keywords and definitions from the external file
Folsom custom skis as discussed in the chapter opener : Folsom Custom Skis, as discussed in the chapter opener, uses a costing system with standard costs for direct materials,

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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