Day of the week: Difference between revisions

Content added Content deleted
(→‎{{header|C++}}: Removed boost usage)
Line 1,644: Line 1,644:


=={{header|C++}}==
=={{header|C++}}==
<syntaxhighlight lang="cpp">#include <boost/date_time/gregorian/gregorian.hpp>
<syntaxhighlight lang="cpp">#include <chrono>
#include <ranges>
#include <iostream>
#include <iostream>


int main( ) {
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 << year << '\n';
}
}
std::cout << "\n" ;
return 0 ;
}</syntaxhighlight>
}</syntaxhighlight>
{{out}}
{{out}}