#include "stdafx.h"
#include <iostream>
using namespace std;
class timekeeper{
private:
DWORD a;
public:
void start();
void stop();
};
void timekeeper::start(){
a=GetTickCount();
}
void timekeeper::stop(){
a=GetTickCount()-a;
cout<<"\n"<<a<<"ms"<<endl;
}
void main()
{
timekeeper timer;
timer.start();
for (int i = 0; i <= 10000; i++){
printf("*");
}
timer.stop();
}
c++计时函数
最新推荐文章于 2024-09-22 18:04:56 发布