Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ Copyright 2017, Dennis Rainey Data Structures Page 1 of 3 HW 5abc HW 5 s- Add a list of numbers using -list 1.)

IN C++ image text in transcribed

image text in transcribed

image text in transcribed

Copyright 2017, Dennis Rainey Data Structures Page 1 of 3 HW 5abc HW 5 s- Add a list of numbers using -list 1.) Declare a list object named: aList 2.) Declare an iterator to be used with list objects and named: 3.) Call a function named: getNumbers it - The function is void-returning - Pass the list object to the function as a parameter. - Use a for loop to insert 5 integer values into the list. With each iteration, prompt the user to enter an integer value. With each iteration, one input value is read into the list object o o 4.) Call a function named: addNumbers Pass the list object to the function as a parameter. - Use a for loop and the iterator, it, to add the values in the list. - The function returns the sum of all list values 5.) Call a function named: displaySum The function displays the list of numbers and the sum. (see output) OUTPUT Enter 5 integer values. Enter a value: 5 Enter a value: 7 Enter a value: 3 Enter a value: 4 Enter a value: 2 Here is the list: 5 734 The sum equals: 21

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books