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
Step: 1
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-text-image.webp)
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Step: 3
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started