返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     int x;
  6.     re:
  7. cout<<"請輸入你想換算的秒數";
  8. cin>>x;
  9. cout<<"可換算為";
  10. if(x<=0){
  11.     goto re;
  12. }

  13. if(x>=604800){
  14.         cout<<x/604800<<"週"<<endl;
  15.         x%=604800;}
  16. if(x>=86400){
  17.         cout<<x/86400<<"週"<<endl;
  18.         x%=86400;}

  19. if(x>=3600){
  20.         cout<<x/3600<<"小時"<<endl;
  21.         x%=3600;}

  22. if(x>=60){
  23.     cout<<x/60<<"分鐘"<<endl;
  24.     x%=60;}
  25. if(x>=1){
  26.     cout<<x/1<<"秒"<<endl;
  27.     x%=1;}

  28.     system("pause");
  29.     return 0;
  30. }
複製代碼

TOP

返回列表