- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int s;
- cout<<"請輸入您想轉換的秒數: ";
- cin>>s;
- cout<<s<<"秒可轉換為..."<<endl;
- cout<<s/(60*60*24*7)<<"周, ";
- s=s%(60*60*24*7);
- cout<<s/(60*60*24)<<"天, ";
- s=s%(60*60*24);
- cout<<s/(60*60)<<"小時, ";
- s=s%(60*60);
- cout<<s/60<<"分鐘, ";
- s=s%60;
- cout<<s<<"秒"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |