Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- const int offset[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
- const std::string daynames[] = {
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
- };
- int main () {
- int day, month, year;
- std::cin >> day >> month >> year;
- year -= month < 3;
- int weekday = (year + year/4 - year/100 + year/400 + offset[month-1] + day) % 7;
- std::cout << "Day: " << daynames[weekday];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement