返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main(void){

  5.     agains:
  6.     int time;
  7.     int tryagain;
  8.     int b;
  9.     /*招呼語*/
  10.     cout << "          ~歡迎來到時間換算系統~" << endl;
  11.     cout << "請輸入秒數:" << endl;
  12.     /*計算秒數*/   
  13.     cin >> time;
  14.     cout << /*輸出時*/ time / 3600 << "時 " << /*輸出分*/ (time % 3600) / 60 << "分 " << /*輸出分*/ (time % 3600) % 60 << "秒" << endl;
  15.     cout << /*輸出時*/ time / 3600 << " : " << /*輸出分*/ (time % 3600) / 60 << " : " << /*輸出分*/ (time % 3600) % 60 << endl;
  16.     cout << endl;
  17.     /*詢問是否繼續*/
  18.     a:
  19.     cout << "繼續 輸入1 / 離開 輸入2" << endl;
  20.     cin >> tryagain;
  21.     if (tryagain == 1){
  22.        cout << "~~________________________________________________~~" << endl;
  23.        goto agains;
  24.     }else if (tryagain > 2){
  25.           cout << "賣亂啦!" << endl;
  26.           goto a;
  27.     }

  28.    system("pause");
  29.    return 0;
  30. }
複製代碼
我是來去無蹤的..

                                ..士豪(Alen)黑輪

TOP

返回列表