求教! error C3861: “getticktime”: 找不到标识符 error C3861: “getticktime”: 找不到标识符
#include<windows.h>#include<iostream>usingnamespacestd;intmain(){doublestart=gettickt...
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
double start=getticktime(),end(0);
//ToDo:process code
int counter_1,counter_2,counter_3;
for (counter_1 = 0;counter_1 < 1000;counter_1++)
for (counter_2 = 0;counter_2 < 1000;counter_2++)
for (counter_3 = 0;counter_3 < 1000;counter_3++)
;
end=getticktime();
double result=end-start;
return 0;
}
计算运行时间的!! 展开
#include <iostream>
using namespace std;
int main()
{
double start=getticktime(),end(0);
//ToDo:process code
int counter_1,counter_2,counter_3;
for (counter_1 = 0;counter_1 < 1000;counter_1++)
for (counter_2 = 0;counter_2 < 1000;counter_2++)
for (counter_3 = 0;counter_3 < 1000;counter_3++)
;
end=getticktime();
double result=end-start;
return 0;
}
计算运行时间的!! 展开
展开全部
没头文件,我也不知道头文件是哪个,不过你可以试下用这个函数取时间time(NULL)
#include <time.h>
long oldTime = time(NULL); //执行一次取得时当前系统时间
for(int i = 0; i<10000; ++i)
{}
long newTime = time(NULL);
#include <time.h>
long oldTime = time(NULL); //执行一次取得时当前系统时间
for(int i = 0; i<10000; ++i)
{}
long newTime = time(NULL);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
double start=GetTickCount(),end(0);
//ToDo:process code
int counter_1,counter_2,counter_3;
for (counter_1 = 0;counter_1 < 1000;counter_1++)
for (counter_2 = 0;counter_2 < 1000;counter_2++)
for (counter_3 = 0;counter_3 < 1000;counter_3++)
;
end=GetTickCount();
double result=end-start;
printf("result=%lf\n",result);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
double start=GetTickCount(),end(0);
//ToDo:process code
int counter_1,counter_2,counter_3;
for (counter_1 = 0;counter_1 < 1000;counter_1++)
for (counter_2 = 0;counter_2 < 1000;counter_2++)
for (counter_3 = 0;counter_3 < 1000;counter_3++)
;
end=GetTickCount();
double result=end-start;
printf("result=%lf\n",result);
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询