定时器源代码c ++

时间:2017-07-18 20:46:06

标签: c++ timer

大家好我找到了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;

我一直遇到的问题是:

  

严重级代码描述项目文件行抑制状态   错误C1075左支撑&#39; {&#39;在文件末尾无法比拟

我不知道我应该在哪里添加一个}?

提前致谢!

1 个答案:

答案 0 :(得分:1)

在返回0;

之后,看起来你在主函数末尾错过了你的结束括号