[英]Timer source code 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;
我不斷遇到的問題是:
嚴重性代碼描述項目文件行抑制狀態錯誤 C1075 左大括號“{”在文件末尾不匹配
我不確定應該在哪里添加 } ?
提前致謝!
看起來您在返回 0 之后在 main 函數的末尾缺少了結束括號;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.