怎么用C++来编程显现系统的时间?

来源:百度知道 编辑:UC知道 时间:2024/05/15 14:11:48
我想知道怎么用C++来编程显现系统的时间?
请高手们指教!

这是MSDN上的经典例子

#include <time.h>
#include <stdio.h>

void main( void )
{
struct tm when;
time_t now, result;
int days;

time( &now );
when = *localtime( &now );
printf( "Current time is %s\n", asctime( &when ) );
}