[英]Timer source code c++
Hi guys i found a timer source code for c++ Found it here: https://www.daniweb.com/programming/software-development/code/216933/a-countdown-timer-in-c大家好,我找到了 C++ 的计时器源代码,在这里找到: https : //www.daniweb.com/programming/software-development/code/216933/a-countdown-timer-in-c
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <Windows.h>
using namespace std;
int main()
{
int m, s, h;
cout << "A COUNTDOWN TIMER " << endl;
cout << "enter time in hours here" << endl;
cin >> h;
cout << "enter time in minutes here " << endl;
cin >> m;
cout << "enter im in seconds here" << endl;
cin >> s;
cout << "Press any key to start" << endl;
cout << " A COUNTDOWN TIMER" << endl;
cout << "time remaining" << endl;
cout << "hours : " << h << "mins : " << m << " secs : " << s << endl;
for (int hour = h; hour >= 0; hour--)
{
for (int min = m; min >= 0; min--)
{
if (min == 0 && h > 0)
m = 59;
for (int sec = s; sec >= 0; sec--)
{
if (sec == 0)
s = 59;
Sleep(1000);
system("cls");
cout << hour << " :hours " << min << " :mins " << sec << " :secs" << endl;
}
}
}
Sleep(1000);
cout << "THE END" << endl;
return 0;
The problem i keep getting is:我不断遇到的问题是:
Severity Code Description Project File Line Suppression State Error C1075 the left brace '{' was unmatched at the end of the file
严重性代码描述项目文件行抑制状态错误 C1075 左大括号“{”在文件末尾不匹配
I'm not sure where I'm supposed to add a } ?我不确定应该在哪里添加 } ?
Thanks in advance!提前致谢!
看起来您在返回 0 之后在 main 函数的末尾缺少了结束括号;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.