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

TOP

返回列表