Reference no: EM132211357
/* Write a program that reads in 10 numbers. Your program should do the following things:
- Determine the number positive or negative
- Count the number of positive and negative numbers
- Output:
--> the sum of all numbers greater than zero
--> the sum of all numbers less than zero (which will be a negative number or zero)
--> the summ lf ALL numbers (whether positive, negative, or zero)
- Calculate the agerage of all the numbers
The user enters the 10 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. */
Here's what I have so far...
#include <iostream>
using namespace std;
int main()
{
int num, num1, num2, num3, num4, num5, num6, num7, num8, num9, num10;
int sum = (num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8 + num9 + num10);
int avg = (num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8 + num9 + num10) / 10;
if (num <= 0)
{
}
}
I'm already confused on what to do. Is there a way to have the user enter in 10 integers (positive and negative) without declaring all the num1, num2, etc.
(I know I need a cout and cin statement as well). And I need help wtih finishing it. I'm also not sure on how to have the program detect if the number is greater than or less than zero (I'm assuming an if statement according the lines of "if(num <=0" ).