Zuma Lifeguard Wiki
mNo edit summary
mNo edit summary
Line 1: Line 1:
  +
Moved to: https://gist.github.com/389714f95bef72844a7c
Code:
 
 
<pre>
 
/* 0 = Sunday, 1 <= m <= 12, y > 1752 or so */
 
int dayofweek(int y, int m, int d)
 
{
 
static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
 
y -= m < 3;
 
return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
 
}
 
</pre>
 
 
Learning to do it from memory:
 
http://www.terra.es/personal2/grimmer/
 
 
[[Category:C Plus Plus]]
 
[[Category:C Plus Plus]]
 
[[Category:Cheat]]
 
[[Category:Cheat]]

Revision as of 08:13, 20 May 2014