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

TOP

返回列表