C++ program to display the calendar
This blog creates a c++program to display the calendar. It prints a month calendar. How to implement the program? First, include the built-in header files and namespace std. Next, check the leap year of the year. It checks the year is divided by 4,100 and 400, then it is leap year. Function daysOfMonth() assigns each month’s days value. For February month,check for leap year and assign the value as 29. Zeller’s Congruence is used to find the weekday. Finally, main() function gets the input as month and year and prints the calendar. Code: #include <iostream> #include <iomanip> using namespace std; // leap year checking function bool checkLeap(int yr) { return (yr % 4 == 0 && yr % 100 != 0) || (yr % 400 == 0); } // days of the month int daysOfMonth(int yr, int month) { int days[] = {31,28,31,30,31,30,31,31,30,31,30,31}; ...