Minggu, 01 Mei 2016

Kasus 6.2

Assalamu'alaikum..
Semoga allah selalu menjaga kita dari segala keburukan..

Pada kesempatan ini akan saya bagikan source code program rata-rata dengan bahasa C++.



C++



     #include <iostream>
#include <cmath>
using namespace std;
void calculateMean(double, double);
void calculateStandardDeviation(double, double, double);
void getLetterGrade();
int main()
{
 double count;
 double score, totalScores = 0.0, mean = 0.0;
 cout << "How many scores do you wish to enter? ";
 cin >> count;
 for (double num = 1.0; num <= count; num++)
 {
  cout << "Enter score " << num << ": ";
  cin >> score;
  totalScores = totalScores + score;
 }
  calculateMean(count, totalScores);
  calculateStandardDeviation(count, mean, totalScores);
 getLetterGrade();
 return 0;
}
void calculateMean(double numberScores, double totalScores)
{
 double mean;
 mean = (1.0 / numberScores) * totalScores;
 cout << "The mean of the scores is " << mean << endl;
}
void calculateStandardDeviation(double mean, double count, double totalScores)
{
 double standardDeviation;
 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;
}
void getLetterGrade()
{

}


Hasil

0 komentar:

Posting Komentar