Day of the week: Difference between revisions

→‎{{header|C++}}: Removed boost usage
(→‎{{header|C++}}: Removed boost usage)
Line 1,644:
 
=={{header|C++}}==
<syntaxhighlight lang="cpp">#include <boost/date_time/gregorian/gregorian.hppchrono>
#include <ranges>
#include <iostream>
 
int main( ) {
std::cout << "Yuletide holidays must be allowed in the following years:\n" ;
using namespace boost::gregorian ;
for (int year : std::views::iota(2008, 2121)
 
| std::views::filter([](auto year) {
std::cout
if (std::chrono::weekday{
<< "Yuletide holidays must be allowed in the following years:\n" ;
std::chrono::year{year}/std::chrono::December/25}
for ( int i = 2008 ; i < 2121 ; i++ ) {
== std::chrono::Sunday) {
greg_year gy = i ;
date d ( gy, Dec , 25 ) return true;
if ( d.day_of_week( ) == Sunday ) { }
return false;
std::cout << i << std::endl ;
})) {
std::cout << iyear << std::endl '\n';
}
std::cout << "\n" ;
return 0 ;
}</syntaxhighlight>
{{out}}
11

edits