#include "stdafx.h"
#include <iostream> 
using namespace std;
void main();


int _tmain(int argc, _TCHAR* argv[])

 {
    double sum_positive=0,sum_negative=0,sum_total=0,num;
    int total_negative_number=0,total_positive_number=0;

    cout << "Enter number.\n" << endl;
    for (int i=0;i<10;i++)
     {
             cin >> num;
         sum_total +=num ;

         if (num>0) 
         {
             sum_positive+=num;
             total_positive_number++;
         }

         else
         {
             sum_negative +=num;
             total_negative_number++;
         }
     }

     cout <<"Sum of all positive numbers: \n" <<sum_positive<<endl;

     cout <<"Average of all posotive numbers: \n" <<sum_positive/total_positive_number<<endl;

     cout <<"Sum of all negative numbers: \n" <<sum_negative<<endl;

     cout <<"Average of all negative numbers: \n" <<sum_positive/total_negative_number<<endl;

     cout <<"Total sum of all numbers: \n" <<sum_total<<endl;

     cout <<"Average of all numbers: \n" <<sum_total/10<<endl;

     system ("Pause");

     cin.sync ();
     cin.get (); 

     return 0;

}

i can't get this to work with while loop. anyone help me so i can use it in while loop

int count = 0;
while (count < 10)
{
 .
 .
 .
 .
 .
 count++;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.