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

TOP

返回列表