/****************************************************************************** * This program computes the prices of soda on sale. * * Copyright © 2021 Richard Lesh. All rights reserved. *****************************************************************************/ #undef NDEBUG #include #include #include #include using namespace std; static double const PRICE_PER_BOTTLE = 1.29; static int const FREE_BOTTLE = 3; int main(int argc, char **argv) { for (int i = 1; i <= 12; ++i) { double price = i * PRICE_PER_BOTTLE; price -= floor(i / double(FREE_BOTTLE)) * PRICE_PER_BOTTLE; cout << fmt::format("{0:d} bottle(s) is ${1:.2f}", i, price) << endl; } return 0; }