#include #include //for the i/o manipulator setprecision #include #include //for class system_clock #include //for the function localtime and structure tm using namespace std; int main() { const auto now {chrono::system_clock::now()}; const time_t t {chrono::system_clock::to_time_t(now)}; const tm *const p {localtime(&t)}; const int weekday {p->tm_wday}; //0 = Sun, 1 = Mon, 2 = Tue, etc. double price1; if (weekday == 0) { price1 = 30.00; //Haircut more expensive on Sundays. } else { price1 = 20.00; //Haircut less expensive on other days. } //Another way to do the same thing. //This time, the price can be const. const double price2 {weekday == 0 ? 30.00 : 20.00}; cout << "$" << fixed << setprecision(2) << price1 << "\n"; cout << "$" << fixed << setprecision(2) << price2 << "\n"; return EXIT_SUCCESS; }