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
#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
I'm not sure where I'm supposed to add a } ?
Thanks in advance!
看起来您在返回 0 之后在 main 函数的末尾缺少了结束括号;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.