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

TOP

返回列表