【程序91】
题目:时间函数举例1
1.程序分析:
2.程序源代码:
| #include "stdio.h" #include "time.h" void main() { time_t lt; /*define a longint time varible*/ lt=time(NULL);/*system time and date*/ printf(ctime(<)); /*english format output*/ printf(asctime(localtime(<)));/*tranfer to tm*/ printf(asctime(gmtime(<))); /*tranfer to Greenwich time*/ } |
【程序92】
题目:时间函数举例2
1.程序分析:
2.程序源代码:
| /*calculate time*/ #include "time.h" #include "stdio.h" main() { time_t start,end; int i; start=time(NULL); for(i=0;i<3000;i++) { printf("\1\1\1\1\1\1\1\1\1\1\n"); } end=time(NULL); printf("\1: The different is %6.3f\n",difftime(end,start)); } |
【程序93】
题目:时间函数举例3
1.程序分析:
2.程序源代码:
| /*calculate time*/ #include "time.h" #include "stdio.h" main() { clock_t start,end; int i; double var; start=clock(); for(i=0;i<10000;i++) { printf("\1\1\1\1\1\1\1\1\1\1\n"); } end=clock(); printf("\1: The different is %6.3f\n",(double)(end-start)); } |
【程序94】
题目:时间函数举例4,一个猜数游戏,判断一个人反应快慢。(版主初学时编的)
1.程序分析:
2.程序源代码:
|
#include "time.h" |
相关专题
- C/C++进阶技术文档 (821篇文章)
- 在Ubuntu 7.10中用终端编译运行C++程序 (0次浏览)
- C与C++在Linux下的集成问题 (0次浏览)
- 浅析C++中虚函数的调用及对象内部布局 (0次浏览)
- 在C++中实现四种进程或线程同步互斥的控制 (0次浏览)
- Ubuntu下面的C语言代码检查工具 Splint (0次浏览)



