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