返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     re:
  8.     system("cls");   
  9.     int sec;
  10.     int c;
  11.     double c1, c2;
  12.     cout << "請輸入要數的秒數:";
  13.     cin >> sec;
  14.     c1 = clock();
  15.     while (true)
  16.     {
  17.           c2 = clock();
  18.           c = (c2 - c1) / 1000;
  19.           cout << (c2 - c1) / 1000 << "秒" << endl;
  20.           system("cls");
  21.           if (c == sec)
  22.              break;
  23.     }
  24.     cout << "時間到!  經過了" << sec <<"秒" << endl;;
  25.     system("pause");
  26.     goto re;
  27.     return 0;   
  28. }
複製代碼

TOP

返回列表