Write a program that reads an unspecified number of integers, determines how many positive and egative values have been read and computes the total and average of the input values (not counting 0). Program ends with the input 0. Display the average as a floating point number. Should look something like: Enter an interger, the input ends if it is 0; The number of positives is..... The number of negatives is....... The total is...... The average is...... Thanks for your help
Explanation / Answer
#include #include using namespace std; int main() { int count =0; int sum = 0; int positivecount = 0; int negativecount = 0; double average; cout count; while(count != 0) { sum += count; average = sum / static_cast(count); count++; if(count < 0) { negativecount++; } if (count > 0) { positivecount++; } cout count; } cout