- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main(void){
- agains:
- int time;
- int tryagain;
- int b;
- /*招呼語*/
- cout << " ~歡迎來到時間換算系統~" << endl;
- cout << "請輸入秒數:" << endl;
- /*計算秒數*/
- cin >> time;
- cout << /*輸出時*/ time / 3600 << "時 " << /*輸出分*/ (time % 3600) / 60 << "分 " << /*輸出分*/ (time % 3600) % 60 << "秒" << endl;
- cout << /*輸出時*/ time / 3600 << " : " << /*輸出分*/ (time % 3600) / 60 << " : " << /*輸出分*/ (time % 3600) % 60 << endl;
- cout << endl;
- /*詢問是否繼續*/
- a:
- cout << "繼續 輸入1 / 離開 輸入2" << endl;
- cin >> tryagain;
- if (tryagain == 1){
- cout << "~~________________________________________________~~" << endl;
- goto agains;
- }else if (tryagain > 2){
- cout << "賣亂啦!" << endl;
- goto a;
- }
- system("pause");
- return 0;
- }
複製代碼 |