mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-05 21:54:27 +02:00
Updated Boost datetime Examples Translated (markdown)
@@ -252,7 +252,7 @@ main()
|
|||||||
```
|
```
|
||||||
<a name="Print_Holidays"></a>
|
<a name="Print_Holidays"></a>
|
||||||
### Print Holidays
|
### Print Holidays
|
||||||
|
```c++
|
||||||
#include "date.h"
|
#include "date.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -276,19 +276,19 @@ main()
|
|||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
using namespace date;
|
||||||
|
|
||||||
std::cout << "Enter Year: ";
|
std::cout << "Enter Year: ";
|
||||||
int y;
|
year y;
|
||||||
std::cin >> y;
|
std::cin >> parse("%Y", y);
|
||||||
|
|
||||||
using namespace date;
|
|
||||||
//define a collection of holidays fixed by month and day
|
//define a collection of holidays fixed by month and day
|
||||||
auto holidays = generate_holidays(year{y});
|
auto holidays = generate_holidays(y);
|
||||||
for (const auto& d : holidays)
|
for (const auto& d : holidays)
|
||||||
std::cout << d << " [" << weekday(d) << "]\n";
|
std::cout << d << " [" << weekday{d} << "]\n";
|
||||||
std::cout << "Number Holidays: " << holidays.size() << '\n';
|
std::cout << "Number Holidays: " << holidays.size() << '\n';
|
||||||
}
|
}
|
||||||
|
```
|
||||||
<a name="Print_Month"></a>
|
<a name="Print_Month"></a>
|
||||||
### Print Month
|
### Print Month
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user