Day of the week: Difference between revisions

Content added Content deleted
(add JavaScript)
No edit summary
Line 178:
25 December 2033 is Sunday
2037 is the last year we can specify
</pre>
 
=={{header|C++}}==
<lang C++>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <iostream>
 
int main( ) {
using namespace boost::gregorian ;
 
std::cout
<< "Yuletide holidays must be allowed in the following years:\n" ;
for ( int i = 2008 ; i < 2121 ; i++ ) {
greg_year gy = i ;
date d ( gy, Dec , 25 ) ;
if ( d.day_of_week( ) == Sunday ) {
std::cout << i << std::endl ;
}
}
std::cout << "\n" ;
return 0 ;
}
</lang>
This produces the following output:
<pre>
Yuletide holidays must be allowed in the following years:
2011
2016
2022
2033
2039
2044
2050
2061
2067
2072
2078
2089
2095
2101
2107
2112
2118
</pre>