Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that sums a sequence of integers. Your program should read only one value at a time. Sum only the nonnegative integers

Write a C++ program that sums a sequence of integers. Your program should read only one value at a time. Sum only the nonnegative integers (skip, do not include any negative integers in the sum). Compute the average of the list of nonnegative integers.

Also the count the numbers of zeros on the file, positive even numbers on the file, the number of positive odd numbers and the number of integer less than zero on the file.

Write the output report to a file.

Data Report

The Average is 999.99

There are 99 positve even numbers on file.

There are 99 positve odd numbers on file.

There are 99 integers less than zero on file.

The number ZERO occurs 99 times on the file.

Note: zero is not considered either positive or negative.

Numbers on the file:

4 5 0 -1 -2 3 6 7 4 2 8 20 3 1 -3 -5 0 2 0 -4 6 16 19 0 0 0 -1 01 -1 -3 -4 0 1 23 4 

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 Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions