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 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
Get step-by-step solutions from verified subject matter experts
