Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function named addPositive which has two input parameters: numbers (an array of 20 integers) and size (an integer representing the actual size of

Write a function named addPositive which has two input parameters: numbers (an array of 20 integers) and size (an integer representing the actual size of numbers) and two output parameters: numbers (an array of 20 integers) and sumPositive (integer). To compute sumPositive, add the number of values in the numbers array that are positive (above 0 - zero not included). Also, change any negative values in the number array to 0. There is no precondition. The postcondition of the function has two possible outcomes (1) the numbers array has 1 or more positive values (sumPositive is not zero) and the negative values have been changed in numbers, or (2) there are no positive values in the numbers array (sumPositive is 0) and all values were changed to zero in the numbers array. For examples, if the numbers array was {3, 5, -10, 12, -2, -5, 6} and size was 7, sumPositive is 26 (3+5+12+6) and the numbers array is {3, 5, 0, 12, 0, 0, 6}

the display array function has already been provided. Just need help with this function. writing in c++

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions