// p03_17.cpp: Average, variance, and range of a sequence of real numbers
#include <iostream>
using namespace std;

int main() {
double x, s =0, s2=0, minim, maxim;
int n=0;
cout << "Enter two or more numbers, followed by a "
        "nonnumeric character:\n";
while (cin >> x) {
   ++n;
   if (n == 1) minim = maxim = x; else {
   if (x < minim) minim = x;
   if (x > maxim) maxim = x;
   }
 s += x;
 s2 += x * x;
}
if (n < 2) cout << "At least two numbers, please.\n"; else {
cout << "Average:   " << s/n << endl;
cout << "Variance:  " << (s2 - s * s / n)/(n -1) << endl;
cout << "Range:     " << maxim - minim << endl;
}
return 0;
}
