返回列表 發帖
  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<<x<<"秒可換算為";
  10. if(x>60*60*24*7){
  11. cout<<x/60/60/24/7<<"週"<<endl;
  12. x%=60*60*24*7;
  13. }
  14. if(x<60*60*24*7&&x>=60*60*24){
  15. cout<<x/60/60/24<<"天"<<endl;
  16. x%=60*60*24;
  17. }
  18. if(x>=60*60&&x<60*60*24){
  19. cout<<x/60/60<<"小時"<<endl;
  20. x%=60*60;
  21. }
  22. if(x>=60&&x<60*60){
  23. cout<<x/60<<"分鐘"<<endl;
  24. x%=60;
  25. }
  26. if(x<60&&x>0){
  27. cout<<x<<"秒"<<endl;

  28. }




  29. goto re;






  30. system("pause");
  31. return 0;

  32. }
複製代碼

TOP

返回列表