I have an assignment for my C++ class that is mostly complete. However, I am unsure as to how I am supposed to make the program display the days of the current month. I’m able to make it work with user input, but I can’t finish it off the way I’m asked to in the assignment.
{
time_t epSeconds;
tm *pCalendarTime = nullptr;
string monthnames[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
epSeconds = time (NULL);
pCalendarTime = localtime(&epSeconds);
cout << "This is " << monthnames[pCalendarTime->tm_mon] << "," << 1900 + pCalendarTime->tm_year << endl;
}
I tried to change the names to each month so it includes the number of days for the month, but I run into the issue of February. I tried connecting the days to the month but I just keep getting today’s date. I know it’s something silly that I’m just not seeing.
SolidSnake212 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.