C语言如何输入一个(小时:分钟)格式的时间与系统时间比较,得到相差的秒数

最好有编好的代码

参照msdn中的实例,你尽情的发挥把。
#include <time.h>
#include <stdio.h>

int main( void )
{
struct tm *newTime;
time_t szClock;

// Get time in seconds
time( &szClock );

// Convert time to struct tm form
newTime = localtime( &szClock );

// Print local time as a string.
printf_s( "Current date and time: %s", asctime( newTime ) ); // C4996
// Note: asctime is deprecated; consider using asctime_s instead
}
结果:
Current date and time: Sun Feb 03 11:38:58 2002
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-10-06
填写一个结构,不过我忘了什么结构。
相似回答