measure.cpp
/*
  Calculate the difference between the first and last year imported as a 
  percentage. 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 difference/change in value from the first to the last year as a decminal
    value, or 0 if it cannot be calculated

  @example
    Measure measure("pop", "Population");
    measure.setValue(1990, 12345678.9);
    measure.setValue(2010, 12345679.9);
    auto diff = measure.getDifferenceAsPercentage();
*/
Calculate the difference between the first and last year imported as a
percentage. This function should be callable from a constant context and
must promise to not change the state of the instance or throw an exception.
Calculate the difference between the first and last year imported as a percentage . 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::getDifferenceAsPercentage() const{
    if(getDifference() == 0)
        return 0;
    return ((getDifference()/readings.begin()->second) * 100);
}
double Measure :: getDifferenceAsPercentage ( ) const { if ( getDifference ( ) == 0 ) return 0 ; return ( ( getDifference ( ) / readings . begin ( ) -> second ) * 100 ) ; }
Calculate the difference between the first and last year imported as a
percentage.
Calculate the difference between the first and last year imported as a percentage .