I am writing a program and stuck on entering standard deviation. I have looked on previous forum topics and from what I have found this is what I have coded but when I cout my standard deviation I keep getting a 1.#f Can one of you guys take a look and show me what I need to change....
#include <iostream>
#include <cmath>
using namespace std;
//Display functions
void calculateMean(double, double);
void calculateStandardDeviation(double, double, double);
void getLetterGrade();
//enter main function
int main()
{
//Declare variables
double count;
double score, totalScores = 0.0, mean = 0.0;
//ask user how many scores user wishes to enter
cout << "How many scores do you wish to enter? ";
cin >> count;
//for loop statement to enter all the scores from the amount the user wishes to enter
for (double num = 1.0; num <= count; num++)
{
cout << "Enter score " << num << ": ";
cin >> score;
//Calculate the total of the scores
totalScores = totalScores + score;
}
//Function to calculateMean()
calculateMean(count, totalScores);
//Function to calculateStandardDeviation()
calculateStandardDeviation(count, mean, totalScores);
//Function to getLetterGrade()
getLetterGrade();
//return a value
return 0;
}
//calculate Mean function
void calculateMean(double numberScores, double totalScores)
{
//Declare variables
double mean;
//Calculate the mean
mean = (1.0 / numberScores) * totalScores;
//Display the mean
cout << "The mean of the scores is " << mean << endl;
}
//calculateStandardDeviation() function
void calculateStandardDeviation(double mean, double count, double totalScores)
{
//Declare variables
double standardDeviation;
//Calculate the standard Deviation
standardDeviation = sqrt (((pow(totalScores, 2.0)) - ((1.0/count) * (pow(totalScores,2.0)))) / (count - 1.0));
cout << "The standard deviation of the scores is " << standardDeviation << endl;
}
//Determine the letterGrade() function
void getLetterGrade()
{
}