C/C++/Java 程序计时功能函数
摘要:
编写程序肯定要使用计时功能,来判断程序的执行时间。今天Google了一下,自己就梳理总结一下:(1)C/C++程序计时 C/C++中使用的计时函数是clock()。 C语言中的头文件对应是#include,C++中对应的头文件为#include。 如下程序实例,其中clock_t为long类型,CLOCKS_PER_SEC为每秒的时钟周期常数: 1 #include 2 #include 3 using namespace std; 4 5 int test() 6 { 7 int x=0; 8 for(int i=0;i<200000000;i++) 9 ... 阅读全文
posted @ 2013-12-07 14:18 旭东的博客 阅读(4047) 评论(0) 推荐(0)
浙公网安备 33010602011771号