mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-06 22:24:27 +02:00
Updated Boost datetime Examples Translated (markdown)
@@ -163,17 +163,17 @@ look if ported to this library.
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
using namespace date;
|
using namespace date;
|
||||||
int yi, mi;
|
int yi;
|
||||||
std::cout << " Enter Year(ex: 2002): ";
|
std::cout << " Enter Year(ex: 2002): ";
|
||||||
std::cin >> yi;
|
std::cin >> yi;
|
||||||
auto y = year(yi);
|
auto y = year{yi};
|
||||||
assert(y.ok());
|
assert(y.ok());
|
||||||
|
unsigned mi;
|
||||||
std::cout << " Enter Month(1..12): ";
|
std::cout << " Enter Month(1..12): ";
|
||||||
std::cin >> mi;
|
std::cin >> mi;
|
||||||
auto m = month(mi);
|
auto m = month{mi};
|
||||||
assert(m.ok());
|
assert(m.ok());
|
||||||
auto start_of_next_year = (y + years{1})/jan/1;
|
auto start_of_next_year = y/jan/1 + years{1};
|
||||||
auto d = y/m/1;
|
|
||||||
for (auto d = y/m/1; d < start_of_next_year; d += months{1})
|
for (auto d = y/m/1; d < start_of_next_year; d += months{1})
|
||||||
std::cout << year_month_day{d.year()/d.month()/last} << '\n';
|
std::cout << year_month_day{d.year()/d.month()/last} << '\n';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user