MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / main

Function main

Exercises/Modules/Chapter 08/Soln8_01.cpp:13–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11std::string ending(int date_day);
12
13int main()
14{
15 std::cout << "Enter your date of birth." << std::endl;
16 int date_year {year()};
17 int date_month {month()};
18 int date_day {date(date_month, date_year)};
19
20 std::string months[] {"January", "February", "March", "April", "May", "June", "July",
21 "August", "September", "October", "November", "December" };
22
23 std::cout << std::endl;
24 std::cout <<
25 std::format("You were born on the {} of {}, {}.",
26 std::to_string(date_day) + ending(date_day),
27 months[date_month - 1],
28 date_year
29 ) << std::endl;
30}
31
32// Reads an integer that is between lower and upper inclusive
33int validate_input(int lower, int upper, const std::string& description)

Callers

nothing calls this directly

Calls 4

yearFunction · 0.70
monthFunction · 0.70
dateFunction · 0.70
endingFunction · 0.70

Tested by

no test coverage detected