通过对下面程序的分析,发现clock_t 应该是类, 初步估计它的定义应该是放在time.h 这个头文件里面的,但是,我打开time.h 文件看过, 又没有关于clock_t 的定义, 请问为什么#include <stdio.h>
#include <stdlib.h>
#include <time.h>void sleep( clock_t wait ); main( )
{
long i = 600000L;
clock_t start, finish; //clock_t 应该是类
double duration; /* Delay for a specified time. */
sleep( (clock_t)3 * CLOCKS_PER_SEC );
/* Measure the duration of an event. */
printf( "Time to do %ld empty loops is ", i );
start = clock();
while( i-- )
;
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
printf( "%2.1f seconds\n", duration );
}
void sleep( clock_t wait )
{
clock_t goal;
goal = wait + clock();
}
#include <stdlib.h>
#include <time.h>void sleep( clock_t wait ); main( )
{
long i = 600000L;
clock_t start, finish; //clock_t 应该是类
double duration; /* Delay for a specified time. */
sleep( (clock_t)3 * CLOCKS_PER_SEC );
/* Measure the duration of an event. */
printf( "Time to do %ld empty loops is ", i );
start = clock();
while( i-- )
;
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
printf( "%2.1f seconds\n", duration );
}
void sleep( clock_t wait )
{
clock_t goal;
goal = wait + clock();
}
解决方案 »
- CFont类的对象不能使用“=”吗?
- vc6 IDE中是否可以在代码中控制最后生成的output文件?是否可以用#pragma ??
- 哪位大虾能告诉我二维数组如何排序~
- 请教 想传指针给activex 控件,怎么做
- 如何查看一个COM组件实现的所有接口?
- 在线给分:怎么加入一个按钮类?
- 今天对drawitem这个函数探索了很长时间,最后终于能把button改成自己画出的样式,但是有一个问题
- 用VS编写wince程序,printf直接跳过不执行?
- 哪位在VC++里用过MSSCRIPT.OCX的,看看这几行代码!
- 有关IE控件的一个小问题
- 我要在自己的一个对话框中内嵌一个Excel该怎么办?
- DWORD和WORD,int的问题
typedef long clock_t;
#define _CLOCK_T_DEFINED
#endif
在我的电脑上是能够通过编译的。