您的位置:首页 > 编程语言

代码运行时间测试模版

2006-09-19 16:24 239 查看
#include <time.h>
#include <stdio.h>

#include <conio.h>
int main()
{
clock_t t_begin,t_end;

//代码1开始计时
t_begin=clock();
//

//你的程序段1

//
t_end=clock();
printf("代码1所用的时间:%.3f秒/n",(double)(t_end-t_begin)/CLOCKS_PER_SEC);

//代码2开始计时
t_begin=clock();
//

//你的程序段2

//
t_end=clock();
printf("代码2所用的时间:%.3f秒/n",(double)(t_end-t_begin)/CLOCKS_PER_SEC);

getch();

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: