返回列表 發帖
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int s;
  6.     cout << "請輸入換算的秒數: ";
  7.     cin >> s;
  8.     cout << s << "秒可換算為..." << endl;
  9.     if (s/604800){
  10.         cout << s/604800 << "週" << " ";
  11.         s = s%604800;
  12.     }
  13.     if (s/86400){
  14.         cout << s/86400 << "天" << " ";
  15.         s = s%86400;
  16.     }
  17.     if (s/3600){
  18.         cout << s/3600 << "小時" << " ";
  19.         s = s%3600;
  20.     }
  21.     if (s/60){
  22.         cout << s/60 << "分鐘" << " ";
  23.         s = s%60;
  24.     }
  25.     if (s){
  26.         cout << s << "秒" << endl;
  27.     }
  28.     return 0;
  29. }
複製代碼

TOP

返回列表