void convertToPounds(double kilograms, double grams, double& pounds, double& ounces) { double total_weight_kilograms, total_weight_pounds; // converts the entire weight entered by user to just kilograms total_weight_kilograms = kilograms + (grams / gramsPerKilogram); // converts the entire weight to pounds total_weight_pounds = total_weight_kilograms * poundsPerKilogram; // removes fractional part of pounds (floor in cmath library) pounds = floor(total_weight_pounds); // converts the leftover fractional part to ounces ounces = (total_weight_pounds - pounds) * ouncesPerPound; }