- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- re:
- int sec,b;
- double z1,z2;
-
- cout<<"請輸入要數的秒數: ";
- cin>>sec;
- z1 = clock();
-
- while(b != sec)
- {
- z2 = clock();
- b = (z2-z1)/1000;
- cout<<(z2-z1)/1000<<"s!"<<endl;
- system("cls");
-
- }
- cout<<"時間到!過了"<<b<<"s!"<<endl;
- system("pause");
- system("cls");
- goto re;
- return 0;
- }
複製代碼 |