All pastes #189766 Raw Edit

Something

public cpp v1 · immutable
·published 2006-10-03 12:42 UTC
rendered paste body
#include <iostream>#include <iomanip>#include <fstream>using namespace std;int main () {    ifstream in ("data.txt");    int i = 0, ranges [11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};    double item, sum = 0, vsum = 0, min = 11, max = 0;    for (;;) {        if(in >> item) ++i; else break;        sum += item;        vsum += item * item;        if (item < min) min = item;        if (item > max) max = item;        ++ranges[(int)item];    }    vsum -= sum * sum / i;        cout << setprecision(15);    cout << "Mean of the values is:       " << sum / i << endl         << "Variance of the values is:   " << vsum / i << endl         << "Maximum of the values is:    " << max << endl         << "Minimum of the values is:    " << min << endl << endl;    for (int c = 0; c < 11; ++c)        cout << "Number of values in interval [" << setw(2) << c << ", "             << setw(2) << (c+1) << "):   " << ranges[c] << endl;            system("pause");    return 0;}