Answered step by step
Verified Expert Solution
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++
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: 21Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started