在c语言里想要获得程序运行的开始时间和结束时间,怎么写?

2024-12-16 08:02:59
推荐回答(1个)
回答1:

这样干,你少写了两行
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf("程序运行开始,Currentlocal time and date: %s\n", asctime(timeinfo));
……
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf("程序运行结束,Currentlocal time and date: %s", asctime(timeinfo));