#include#include int main() { CTime currentTime = CTime::GetCurrentTime(); int hour = currentTime.GetHour(); std::cout << "The current hour is: " << hour << std::endl; return 0; }
#includeThis code creates a CTime object with a specific date and time, and then uses GetHour function to extract the hour from it. Package library: afxwin.h In both these examples, the package library used is afxwin.h which is a part of the MFC (Microsoft Foundation Class) library. It is a library provided by Microsoft for developing Windows desktop applications in C++.int main() { CTime myTime(2022, 8, 15, 17, 30, 0); int hour = myTime.GetHour(); return 0; }