# sum and average

## Project A

Write a program that ask user for an input file name, reads from the file (it will contain certain number of whole numbers), and outputs:

1. the sum of all the numbers greater than or equal to zero ,
2. the sum of all the numbers less than zero,
3. the sum of all the numbers, whether positive, negative, or zero.

***Use dynamic array***

## Project B

Modify your program from project A so that it outputs:

1. the sum and average of all the numbers greater than or equal to zero ,
2. the sum and average of all the numbers less than zero,
3. the sum and average of all the numbers, whether positive, negative, or zero.

## Requirements

1. The program will loop again to ask if the user wants to process another file

2. Use dynamic array to implement this program

3. Remember to comment well in your program and any functions you use

## Testing

The program should be tested extensively to make sure it work as expected before you hand it in. The program should accept a file like the followings:

1 -1 45 17 28 -2 0 9 -14 11

And outputs something like the following:

• 111 and 15.85 (setprecision to 2) are the sum and average of all the numbers greater than or equal to zero,
• 17 and 5.67 are the sum and average of all the numbers less than zero,
• 94 and 9.4 are the sum and average of all the numbers, whether positive, negative, or zero.

More test cases:

1 2 3 4 5 6 7 8 9 10

-1 -2 -3 -4 -5 -6 -7 -8 -9 -10