im learning basic C++ courses and wanted some help with this problem. Plz help
Thanks,
Anand
Q10
Message: 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 zero (which will be a negative number or zero),
and the sum of all the numbers, whether positive, negative or zero. T
he 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 numbers and the negative numbers separately.
I have done this so far...
Expand|Select|Wrap|Line Numbers
- int main()
- {
- double sum_greater_than_zero = 24;
- double sum_less_than_zero =0;
- double sum_of_all = 0 ;
- int number ;
- cout << "Please press return after entering a value. \n ";
- cout << "What number would you like to pick? \n ";
- cin >> number;
- cout << "Thank You ";
- while ( number != 0 )
- {
- sum_greater_than_zero *= number;
- cout << "The sum is: " << sum_greater_than_zero++ << endl;
- }
- if ( number > 0 )
- sum_greater_than_zero += number;
- else if ( number < 0 )
- sum_less_than_zero += number;
- return 0;
- }
Anand