write a program that reads an unspecified number of integers,determines how many positive and negative values have been read, and computes the total and average of the input values(not counting zeros). your program ends with the input 0. Display the average as floating-point number.
#include <iostream>
using namespace std;
int main()
{
int number=0,positive=0,negative=0,sum=0;
cout<<"Start entering numbers: ";
while (true)
{
& cin>>number;
& if (number==0)
& {
break;
& }
& if (number>0)
& {
positive++;
& }
& else
& {
negative++;
& }
& sum+=number;
}
cout<<positive<<" positive numbers"<<endl;
cout<<negative<<" negative numbers"<<endl;
cout<<"total: "<<sum<<endl;
cout<<"average: "<<((float)sum)/(positive + negative)<<endl;
return 0;
}