title: C++ ,Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers
body: <p>"Count positive and negative numbers and compute the average of numbers 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 a double.  where did i go wrong??</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main()
  
  {
              int num= 0;
              int sum=0;
              int pos=0;
              int neg=0;
              double ave=0;
              cout &lt;&lt; "Enter an integer, the input ends if it is 0: " ;
              cin &gt;&gt; num ;
              if (num%10==10) {
                  while (num!=0) {
                      num/=10;
                      if (num%10&gt;0) {
                          pos++;
                      }
              else if (num%10&lt;0) {
                  neg++;
              }
              sum+=num;
                  }
              ave= (double)sum/(pos+neg);
              }
              cout &lt;&lt;"The number of positives are " &lt;&lt; pos &lt;&lt;endl;
              cout &lt;&lt;"The number of negatives are " &lt;&lt; neg &lt;&lt;endl;
              cout &lt;&lt;"The total is " &lt;&lt; sum &lt;&lt; endl;
              cout &lt;&lt;"The average is "&lt;&lt; ave &lt;&lt; endl;
              return 0;
  
   }
  </code></pre>