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

TOP

返回列表