A simple calendar example code. The easiest way is to use "time" library. It simply uses std::time() and std::localtime() to compute date. Calendar example code is shown below.
#include <ctime> #include <iostream> int main() { std::time_t temp = std::time ( 0 ); std::tm *first = std::localtime ( &temp ); first->tm_year = 2008 - 1900; first->tm_mday = 1; first->tm_mon = 0; if ( std::mktime ( first ) != (std::time_t)-1 ) { char weekday[100]; if ( std::strftime ( weekday, 100, "%A", first ) > 0 ) std::cout<<"The first day of the year is "<< weekday <<'\n'; } }