Simple arithmatic help!!

Write a program that reads in ten whole numbers and that outputs the sum of all the numbers greater than zero, the sum of all the numbers less than or equal to zero (which will be a negative number or zero), and the sum of all numbers, whether positive, negative or zero. The user enters the ten numbers just once each and the user can enter them in any order. Your program should not ask the user to enter the positive and negative numbers separately. You MUST use a loop in this program.

Input: ten numbers
Process:
SumOfPositiveNumbers = 0
SumOfNegativeNumbers = 0
SumOfAllNumbers = 0
LoopCount = 0
While LoopCount < 10
Read value from the keyboard
If value > 0 then
SumOfPositiveNumbers += value
else
SumOfNegativeNumbers += value
SumOfAllNumbers += value
LoopCount ++
End Loop
Display all three sums and identify which sum you are displaying

Outputs: Sum of positive
numbers
Sum of negative
numbers
Sum of all numbers
Well, what do you have so far (and what do you need help with)?

Your pseudocode there should translate fairly straightforwardly into C++.
Topic archived. No new replies allowed.