- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- re:
- double c;
- int sec;
- cout << "請輸入要數的秒數:" ;
- cin >> sec;
- sec = sec*1000;
- clock() == 0;
- for(int i = 0;i<=sec;i++)
- {
- c = clock();
- cout << c/1000 << endl;
- system ("cls");
- if(clock() >= sec)
- break;
- }
- cout << "Time's up we run "<<sec/1000 <<"seconds" << endl;
- system("pause");
- system("cls");
- goto re;
- return 0;
- }
複製代碼 |