Write Stats<T> (constrained to arithmetic T) that accepts values one at a time and reports count, min, max and mean; use it for int marks and double temperatures.
numeric_limits<T> gives the right starting values for each type (lowest() rather than min(), which is the smallest positive value for double). The variadic add_all uses a comma fold.
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!
We use Google Analytics cookies to see how LearnFrenzy is used and make it better, and Google AdSense to keep it free.
No analytics or ad cookies are set until you accept. Privacy Policy
·
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!