#include <iostream>
using namespace std;


int main() {

	int numValue = 1,
	double variance,
		   mean,
		   standDeviation,
		   num,
		   sumvalueSquare,
		   sumValue;

	ifstream myFile;
	myFile. open ("statsFile.txt");


	while ( myFile >> num )
	{
	   sumValue = sumValue + num;
	   sumvalueSquare = pow (sumValue, 2.0);
	   variance = pow (sumValue, 2.0) - (pow (sumValue, 2.0) / numValue) / (numValue - 1);
	   standDeviation = sqrt (variance);
	   mean = sumValue / numValue;
	   cout << num << endl << cout << "The variance is :" << variance << endl 
	        << "The standard deviation is:" << standDeviation << endl 
		    << "The mean is:" << mean << endl;
	   
	}
	 
	myFile. close ();
}
	return 0;
	
//SPEC SHEET:
//1. Declare a variable to hold a counter (that will count the number of
//   values read from the file)
//2. (NO stop value is needed. The loop stops when all values have been read
//   from the file)
//3. Declare one variable to be used (And re-used) for the reading of each 
//  value from the file.
//4. Declare variables for the variance, the mean, and the standard deviation
//5. Declare variable for two total sums: sum of values and sum of each value 
//   squared
//6. Read the values from the file one at a time, and update each of the 2 
//     totals
//7. use both totals to calculate the variance
//8. Use the first total (sum of values) to calculate the mean (mean = total
//    / number of values)
//9. Display the variance, standard deviation and mean

// The teacher also mentioned using getline in the class that day, but she
// did not specifically say that she wanted it on the program, but there could
// be a chance.
}