Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A file Numbers.txt (given below) contains an unknown number of both negative and positive integers. 56 -9 -11 23 1 41 23 -54 3 21

A file Numbers.txt (given below) contains an unknown number of both negative and positive integers.

56

-9

-11

23

1

41

23

-54

3

21

-8

Create a program that reads the numbers from the file, counts and sums all negative numbers and separately all positive numbers (zero is considered positive). Your program should display the final count and sum for these numbers. All these values can and should be computed within one reading pass through the file.

Sample run (not for the given file):

Processing file -- please wait Negative count: 12 Negative sum: -231 Positive count: 9 Positive sum: 145

Hint: follow examples on pages 298, 299 for file processing. Pay close attention to file open errors.

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago