measure.cpp
/*
  TODO: Measure::getAverage()

  Calculate the average/mean value for all the values. This function should be
  callable from a constant context and must promise to not change the state of 
  the instance or throw an exception.

  @return
    The average value for all the years, or 0 if it cannot be calculated

  @example
    Measure measure("pop", "Population");
    measure.setValue(1999, 12345678.9);
    measure.setValue(2001, 12345679.9);
    auto diff = measure.getDifference(); // returns 1
*/
:getAverage()
Calculate the average/mean value for all the values. This function should be
callable from a constant context and must promise to not change the state of
the instance or throw an exception.
: getAverage () Calculate the average / mean value for all the values . This function should be callable from a constant context and must promise to not change the state of the instance or throw an exception .
double Measure::getAverage(){
  int size = values.size();
  double rollingTotal = 0;
  for(auto const& x: values){
    rollingTotal = rollingTotal + x.second;
    }
  return rollingTotal/size;
}
double Measure :: getAverage ( ) { int size = values . size ( ) ; double rollingTotal = 0 ; for ( auto const & x : values ) { rollingTotal = rollingTotal + x . second ; } return rollingTotal / size ; }
TODO: Measure::getAverage()
Calculate the average/mean value for all the values.
TODO : Measure :: getAverage () Calculate the average / mean value for all the values .