//【3】记录起始时间
double time0 = static_cast<double>(getTickCount());
//【5】计算运行时间并输出
time0 = ((double)getTickCount() - time0) / getTickFrequency();
cout << "\t此方法运行时间为: " << time0 << "秒" << endl;//输出运行时间
将二者分别放在程序始末位置即可
//【3】记录起始时间
double time0 = static_cast<double>(getTickCount());
//【5】计算运行时间并输出
time0 = ((double)getTickCount() - time0) / getTickFrequency();
cout << "\t此方法运行时间为: " << time0 << "秒" << endl;//输出运行时间
将二者分别放在程序始末位置即可