please help. I can't figure out just one line of code. Standard deviation calculation. I calculate the mean, which is correct, then subtract the mean from each of the values and square the result. Then I try to find the mean of square result. I add them up - and that's where it adds up to wrong number. I spend hours, and couldn't help myself . Any hint?
and code:
#include <iomanip>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <stdlib.h>
#include <ctime>
#include <cmath>
using namespace std;
////////////////////////CREATE TWO STRUCTURES/////////////////////////////////
struct Date
{ int month;
int day;
int year;
} ;
struct Student
{ string name;
Date dob;
double GPA;
}S[200];
int main()
{
int i = 0;
double meanGPA = 0;
double meanAGE = 0;
double sum = 0;
double ssum = 0;
double sum1 = 0;
double mmeanAge = 0;
double sigmaGPA;
double sigmaAGE;
double coeffAGE;
double coeffGPA;
////////////////////////READ FROM THE FILE ////////////////////////////////////
ifstream rData;
rData.open ("student.txt", ios::out);