Question: Write a program in C++ to read 20 integers into a 1D array using a method > called readdata () of a class named

Write a program in C++ to read 20 integers into a 1D array using a method > called readdata () of a class

Write a program in C++ to read 20 integers into a 1D array using a method > called readdata () of a class named calclass, then add all the positive numbers and place them in a variable sumPositive using a method named sumpos () and add all negative numbers and place them in a I variable sumNegative using a method named negpos (). At the end, the program should display the values in both variables sumPositive and sumNegative. Note: don't forget to initialize your variables sumPositive and sumNegative to 0 inside the methods that are performing the sum on them.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!