CHALLENGE - Find the Standard Deviation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

CHALLENGE - Find the Standard Deviation

Here is an assignment I got in my intro to C++ class and I thought it was valuable to help me learn how classes work and also stretch the way I thought about functions. Write a class called Person that has two data members - a string variable called name and a double variable called age. It should have a constructor that takes two values and uses them to initialize the data members. It should have get methods for both data members (getName and getAge). Write a separate function (not part of the Person class) called stdDev that takes two parameters - an array of Person objects and the size of the array - and returns the standard deviation of all the ages (the population standard deviation that uses a denominator of N, not the sample standard deviation, which uses a different denominator). Here is my submittion in c++: https://code.sololearn.com/cF5N5453hcSP/#cpp

24th Oct 2017, 3:17 PM
Craig
Craig - avatar
1 Answer
0
Yes, I used the entire class array to determine the standard deviation of all the ages.
25th Oct 2017, 5:58 PM
Craig
Craig - avatar