-2
我正在嘗試使計數器持續1分鐘,或以秒和分鐘顯示已用時間。C++中的分鐘計數器
這是我正在使用的代碼,但它沒有顯示時間,只是零。
char str[200];
double t = (double)getTickCount();
t = ((double)getTickCount() - t)/getTickFrequency();
sprintf(str, "%f detection time", t);
putText(matCapturedImage, str, Point2f(100, 100), FONT_HERSHEY_PLAIN, 0.7, Scalar(0, 0, 255, 255));`
可以包含一個完整的例子嗎? – callyalater
調用'getTickCount'兩次,它們之間沒有代碼可能會給你相同數量的刻度。 – NathanOliver
我使用的代碼非常長,我只是放了相關部分 – tofi