各位大虾求救啊,小弟初学C++,编译时报错error C2039: 'clock_t' : is not a member of 'std' 10
classstopwatch{public://stopwatch():start(clock()){}//startcountingtimestopwatch():st...
class stopwatch
{
public:
//stopwatch() : start(clock()){} //start counting time
stopwatch() : start(std::clock()){} //start counting time
~stopwatch();
double get_time()
{
clock_t total = clock()-start;;
return double(total)/CLOCKS_PER_SEC;
};
private:
std::clock_t start; 就是这里错了!!!!!!!!
//clock_t start;
};
stopwatch::~stopwatch()
{
clock_t total = clock()-start; //get elapsed time
cout<<"Time(secs): "<<double(total)/CLOCKS_PER_SEC<<endl;
} 展开
{
public:
//stopwatch() : start(clock()){} //start counting time
stopwatch() : start(std::clock()){} //start counting time
~stopwatch();
double get_time()
{
clock_t total = clock()-start;;
return double(total)/CLOCKS_PER_SEC;
};
private:
std::clock_t start; 就是这里错了!!!!!!!!
//clock_t start;
};
stopwatch::~stopwatch()
{
clock_t total = clock()-start; //get elapsed time
cout<<"Time(secs): "<<double(total)/CLOCKS_PER_SEC<<endl;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询