No Output on Screen

Hi guys , how do i get the program to display the average and standard deviation . there is no output on my screen.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  #include <iostream>
#include<cstdlib>
#include<fstream>
#include<iomanip>
#include<cmath>
using namespace std;
// Program reads input from a file with numbers of type double
// displays their average and standard deviation  on the screen.
int main()
{
    ifstream fin;
    fin.open("inputData.dat");
    ofstream fout;
    fout.open("outputData.dat");

    double next, sum = 0 ;
    int count = 0, avg = 0, stdDev = 0, variance;

    while(fin >> next)
    {
        cout<<setw(6)<<next<<endl;

    }
    while (fin >> next )
    {

        fin>>next;
        sum = sum + next;
        count ++;
        avg =  sum / count ;
        variance = pow((avg - next),2);
        stdDev = sqrt(variance);
        cout<<" The Average of the numbers is "<<avg<<endl;
        cout<<" whilst their standard deviation is "<<stdDev<<endl;
    }

    fin.close();
    fout.close();

    return 0;

}
closed account (48T7M4Gy)
http://www.cplusplus.com/forum/beginner/207129/
Topic archived. No new replies allowed.