standard deviation

#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;

int main()
{

float deviation;
float count=0;
float sum1;
float sum2;
float current;

ifstream myFile;
myFile.open("scores.dat");
myFile>>current;
while(myFile)
{
sum1=sum1+current;
sum2=sum2+pow(current,2);
count++;
myFile>>current;
}

deviation=(sum1-sum2)/((current)*(current-1));
cout<<"The standard deviation of the set of data is: "<<deviation<<endl;
myFile.close();











system("pause");
return 0;

}

//cant figure out what is wrong?? any ideas?
What's your problem exactly? What error message?

Just looking at this code, it probably won't compile, because you use "system()" without including the header (<cstdlib>) that declares it.
Try "#include <cstdlib>"

Since you're using super-duper C++, perhaps instead of 'system("pause")', try something like "cin.get()" Same effect.
Topic archived. No new replies allowed.