#include#include #include #include using namespace std; clock_t startTime, endTime; int main() { startTime = clock(); //程序开始计时 double sum = 50; //50秒 double time = .0; int flag = 1; while (1) { endTime = clock(); time = (double)(endTime - startTime) / 1000; if (flag == 1) { cout << "00:" << sum << endl; flag = 0; } if (time > 1) { sum--; time -= 1; flag = 1; startTime = endTime; } if (sum == 0) break; } system("pause"); return 0; }
这是很久以前写图形界面的时候要用到的,现在做个记录
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)