0

Hello, I started c++, and I recently got an assignment, which is supposed to calculate the sum, variance, mean deviation, and mean in a set. The user can input any number positive or negative for the set. Because it is a set, the person may enter as many numbers as they want. I have succeeded in making the program do addition and mean/average. I need help in coming up with a function which will make a variance, and then square root of that will give mean deviation. Use the following website to get the formula (online algorithm). The problem is that there are some things that i don't know what it stands for or what it does: http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm

any help is appreciated.

```
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
void main()
{
double value = 0;
double sum = 0;
int count = 0;
double cnt = 0;
double mean = 0;
while(value != -1)
{
cout << "Enter a value: ";
cin >> value;
if (value != -1)
{
cnt++;
sum += value;
}
}
cout << "Number: " << cnt << endl;
cout << "Sum: " << sum << endl;
mean = sum/cnt;
cout << fixed << showpoint << setprecision(2) << "Average: " << mean;
fflush(stdin);
cout << "\n press enter to end" ;
cin.get();
}
double deviation(double mean, int cnt, double sum)
{
}
```