- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main(){
- int x;
- re:
- cout<<"請輸入你想換算的秒數";
- cin>>x;
- cout<<"可換算為";
- if(x<=0){
- goto re;
- }
- if(x>=604800){
- cout<<x/604800<<"週"<<endl;
- x%=604800;}
- if(x>=86400){
- cout<<x/86400<<"週"<<endl;
- x%=86400;}
- if(x>=3600){
- cout<<x/3600<<"小時"<<endl;
- x%=3600;}
- if(x>=60){
- cout<<x/60<<"分鐘"<<endl;
- x%=60;}
- if(x>=1){
- cout<<x/1<<"秒"<<endl;
- x%=1;}
- system("pause");
- return 0;
- }
複製代碼 |