【发布时间】:2021-09-29 16:17:17
【问题描述】:
所以我一直在做一个基于终端的测验作为我的第一年项目,我决定在代码中显示一个计时器,但是由于在计时器。
我该如何解决这个问题?
void timer()
{
while (true) {
clock_display();//Function loaded with manipulators to just show the 00:00:00 interface
sleep(1);
sec++;
if (sec == 60) {
mins++;
if (mins == 60) {
hrs++;
mins = 0;
}
sec = 0;
}
}
}
int main(){
timer();
//Other code I have to run
}
【问题讨论】:
标签: c++ multithreading timer clock ctime