std::vector<double> hours holds 0.5, 0.5, 0.5. wrote std::accumulate(hours.begin(), hours.end(), 0). I have now worked three half-hours for a total of zero. terminal doesn't even have the elegance to look ashamed.
¿Qué tipo tiene ese cero del final? Hazme la cuenta guardando CADA resultado parcial en un entero y dime si el pobre llega alguna vez a juntar dos medias horas.
0 + .5 into an int gives 0. Then same again and again. Swapped to 0.0, got 1.5. Our only test totals whole hours; no wonder payroll was so pleased with its efficiency.
ok now try it with the first value 1.5 and the next 0.5. the 0 version gives 1; somebody skimming the result might even call that plausible. exact half hours make good tiny inputs here.
kept the three halves. also kept a test for empty input which really SHOULD pay me zero. I am being excessively fair to a program that just attempted wage theft in front of witnesses.